Package com.mg105.use_cases.inventory
Class ItemFactory
java.lang.Object
com.mg105.use_cases.inventory.ItemFactory
This class's sole responsibility is to create new items.
This is done by using the simple factory design pattern
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription@NotNull Item
createItem
(@NotNull String itemName) Returns a new instance of an item given the item's name
-
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
-