Class InventoryItem<T extends InventoryItem<T>>
java.lang.Object
org.salespointframework.core.AbstractEntity<InventoryItem.InventoryItemIdentifier>
org.salespointframework.core.AbstractAggregateRoot<InventoryItem.InventoryItemIdentifier>
org.salespointframework.inventory.InventoryItem<T>
- All Implemented Interfaces:
Persistable<InventoryItem.InventoryItemIdentifier>
- Direct Known Subclasses:
MultiInventoryItem
,UniqueInventoryItem
@MappedSuperclass
public abstract class InventoryItem<T extends InventoryItem<T>>
extends AbstractAggregateRoot<InventoryItem.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:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
InventoryItemIdentifier
serves as an identifier type forUniqueInventoryItem
objects. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondecreaseQuantity
(Quantity quantity) Decreases the quantity of the currentInventoryItem
by the givenQuantity
.getId()
protected abstract Product
Returns theProduct
thisInventoryItem
belongs to.boolean
hasSufficientQuantity
(Quantity quantity) Returns whether theInventoryItem
is available in exactly or more of the given quantity.increaseQuantity
(Quantity quantity) Increases the quantity of the currentInventoryItem
by the givenQuantity
.boolean
keepsTrackOf
(Product product) Returns whether theInventoryItem
belongs to the givenProduct
.toString()
Methods inherited from class org.salespointframework.core.AbstractAggregateRoot
registerEvent
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.
-
-
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
-