Class InventoryItem<T extends InventoryItem<T>>
java.lang.Object
org.salespointframework.core.AbstractEntity<ID>
org.salespointframework.core.AbstractAggregateRoot<InventoryItemIdentifier>
org.salespointframework.inventory.InventoryItem<T>
- All Implemented Interfaces:
Persistable<InventoryItemIdentifier>
- Direct Known Subclasses:
MultiInventoryItem
,UniqueInventoryItem
@MappedSuperclass public abstract class InventoryItem<T extends InventoryItem<T>> extends AbstractAggregateRoot<InventoryItemIdentifier>
An
InventoryItem
associates a product with a Quantity
to keep track of how many items per product are
available.- Since:
- 7.2
- Author:
- Paul Henke, Oliver Drotbohm, Martin Morgenstern
- See Also:
UniqueInventoryItem
,MultiInventoryItem
-
Constructor Summary
Constructors Modifier Constructor Description protected
InventoryItem()
protected
InventoryItem(Product product, Quantity quantity)
-
Method Summary
Modifier and Type Method Description T
decreaseQuantity(Quantity quantity)
Decreases the quantity of the currentInventoryItem
by the givenQuantity
.InventoryItemIdentifier
getId()
protected abstract Product
getProduct()
Returns theProduct
thisInventoryItem
belongs to.Quantity
getQuantity()
boolean
hasSufficientQuantity(Quantity quantity)
Returns whether theInventoryItem
is available in exactly or more of the given quantity.T
increaseQuantity(Quantity quantity)
Increases the quantity of the currentInventoryItem
by the givenQuantity
.boolean
keepsTrackOf(Product product)
Returns whether theInventoryItem
belongs to the givenProduct
.String
toString()
Methods inherited from class org.salespointframework.core.AbstractEntity
equals, hashCode, hasId, isNew
-
Constructor Details
-
InventoryItem
- Parameters:
quantity
- the initialQuantity
for thisInventoryItem
, must not be null.
-
InventoryItem
protected InventoryItem()
-
-
Method Details
-
getId
-
hasSufficientQuantity
Returns whether theInventoryItem
is available in exactly or more of the given quantity.- Parameters:
quantity
- must not be null.- Returns:
-
decreaseQuantity
Decreases the quantity of the currentInventoryItem
by the givenQuantity
.- Parameters:
quantity
- must not be null.
-
increaseQuantity
Increases the quantity of the currentInventoryItem
by the givenQuantity
.- Parameters:
quantity
- must not be null.
-
keepsTrackOf
Returns whether theInventoryItem
belongs to the givenProduct
.- Parameters:
product
- must not be null.- Returns:
-
getProduct
Returns theProduct
thisInventoryItem
belongs to.- Returns:
- must not be null.
-
toString
-
getQuantity
-