Class ItemFactory

java.lang.Object
com.mg105.use_cases.inventory.ItemFactory

public class ItemFactory extends Object
This class's sole responsibility is to create new items. This is done by using the simple factory design pattern
  • Constructor Details

    • ItemFactory

      public ItemFactory()
  • Method Details

    • createItem

      @NotNull public @NotNull Item createItem(@NotNull @NotNull String itemName) throws NoSuchElementException
      Returns a new instance of an item given the item's name
      Parameters:
      itemName - the name of the item to make a new instance of
      Returns:
      the instance of the new item
      Throws:
      NoSuchElementException - if no item of the name itemName can be created