Package no.ntnu.idatt1002.demo.data
Class InventoryItem
java.lang.Object
no.ntnu.idatt1002.demo.data.Item
no.ntnu.idatt1002.demo.data.ShoppingListItem
no.ntnu.idatt1002.demo.data.InventoryItem
- All Implemented Interfaces:
Storable
This class is a simple bean for an inventory item.
This is an item with a quantity, a unit and an expiration date.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionInventoryItem(int inventoryId, int itemId, String name, String category, String allergy, int quantity, String unit, int expirationDate) Constructor for the InventoryItem class.InventoryItem(int itemId, String name, String category, String allergy, int quantity, String unit, int expirationDate) Constructor for the InventoryItem class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the attribute names of the inventory item.Returns the attributes of the inventory item.intGetter method for the expiration date.intgetId()Returns the id of the inventory item.Returns the name of the id.intGetter method for the inventory id.Methods inherited from class no.ntnu.idatt1002.demo.data.ShoppingListItem
getQuantity, getShoppingListItemId, getUnitMethods inherited from class no.ntnu.idatt1002.demo.data.Item
getAllergy, getCategory, getItemId, getName, toString
-
Field Details
-
inventoryId
private int inventoryId -
expirationDate
private final int expirationDate
-
-
Constructor Details
-
InventoryItem
public InventoryItem(int itemId, String name, String category, String allergy, int quantity, String unit, int expirationDate) Constructor for the InventoryItem class.- Parameters:
name- the name of the itemcategory- the category of the itemallergy- the allergy of the itemquantity- the quantity of the itemunit- the unit of the itemexpirationDate- the expiration date of the item
-
InventoryItem
public InventoryItem(int inventoryId, int itemId, String name, String category, String allergy, int quantity, String unit, int expirationDate) Constructor for the InventoryItem class.- Parameters:
inventoryId- the id of the inventory itemitemId- the id of the itemname- the name of the itemcategory- the category of the itemallergy- the allergy of the itemquantity- the quantity of the itemunit- the unit of the itemexpirationDate- the expiration date of the item
-
-
Method Details
-
getAttributes
Returns the attributes of the inventory item.- Specified by:
getAttributesin interfaceStorable- Overrides:
getAttributesin classShoppingListItem- Returns:
- the attributes of the inventory item
-
getAttributeNames
Returns the attribute names of the inventory item.- Specified by:
getAttributeNamesin interfaceStorable- Overrides:
getAttributeNamesin classShoppingListItem- Returns:
- the attribute names of the inventory item
-
getId
public int getId()Returns the id of the inventory item.- Specified by:
getIdin interfaceStorable- Overrides:
getIdin classShoppingListItem- Returns:
- the id of the inventory item
-
getIdName
Returns the name of the id.- Specified by:
getIdNamein interfaceStorable- Overrides:
getIdNamein classShoppingListItem- Returns:
- the name of the id
-
getExpirationDate
public int getExpirationDate()Getter method for the expiration date.- Returns:
- the expiration date
-
getInventoryId
public int getInventoryId()Getter method for the inventory id.- Returns:
- the inventory id
-