Class InventoryItem
java.lang.Object
csce331.group13.project2.models.InventoryItem
Represents an inventory item in the system.
Stores information about stock levels, unit costs, and availability.
- Author:
- Varish Kongara
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor for InventoryItem.InventoryItem(String item, String unit, BigDecimal stock, BigDecimal unitCost, boolean available) Constructs an InventoryItem with a newly generated UUID.InventoryItem(UUID itemId, String item, String unit, BigDecimal stock, BigDecimal unitCost, boolean available) Constructs an InventoryItem with all fields specified. -
Method Summary
Modifier and TypeMethodDescriptiongetItem()Gets the inventory item's name.Gets the inventory item's unique identifier.getStock()Gets the current stock quantity.getUnit()Gets the unit of measurement for this item.Gets the cost per unit.booleanChecks if the inventory item is currently available.voidsetAvailable(boolean available) Sets the availability status of the inventory item.voidSets the inventory item's name.voidSets the inventory item's unique identifier.voidsetStock(BigDecimal stock) Sets the current stock quantity.voidSets the unit of measurement for this item.voidsetUnitCost(BigDecimal unitCost) Sets the cost per unit.toString()
-
Constructor Details
-
InventoryItem
public InventoryItem()Default constructor for InventoryItem. -
InventoryItem
public InventoryItem(UUID itemId, String item, String unit, BigDecimal stock, BigDecimal unitCost, boolean available) Constructs an InventoryItem with all fields specified.- Parameters:
itemId- The unique identifier for the inventory item.item- The name of the inventory item.unit- The unit of measurement (e.g., "lbs", "oz", "count").stock- The current stock quantity.unitCost- The cost per unit.available- Whether the item is currently available.
-
InventoryItem
public InventoryItem(String item, String unit, BigDecimal stock, BigDecimal unitCost, boolean available) Constructs an InventoryItem with a newly generated UUID.- Parameters:
item- The name of the inventory item.unit- The unit of measurement (e.g., "lbs", "oz", "count").stock- The current stock quantity.unitCost- The cost per unit.available- Whether the item is currently available.
-
-
Method Details
-
getItemId
-
setItemId
Sets the inventory item's unique identifier.- Parameters:
itemId- The new item ID.
-
getItem
-
setItem
Sets the inventory item's name.- Parameters:
item- The new item name.
-
getUnit
Gets the unit of measurement for this item.- Returns:
- The unit (e.g., "lbs", "oz", "count").
-
setUnit
Sets the unit of measurement for this item.- Parameters:
unit- The new unit.
-
getStock
-
setStock
Sets the current stock quantity.- Parameters:
stock- The new stock quantity.
-
getUnitCost
-
setUnitCost
Sets the cost per unit.- Parameters:
unitCost- The new unit cost.
-
isAvailable
public boolean isAvailable()Checks if the inventory item is currently available.- Returns:
- true if available; false otherwise.
-
setAvailable
public void setAvailable(boolean available) Sets the availability status of the inventory item.- Parameters:
available- The new availability status.
-
toString
-