Class InventoryItem<T extends InventoryItem<T>>
java.lang.Object
org.salespointframework.core.AbstractEntity<ID>
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
Nested ClassesModifier and TypeClassDescriptionstatic classInventoryItemIdentifierserves as an identifier type forUniqueInventoryItemobjects. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondecreaseQuantity(Quantity quantity) Decreases the quantity of the currentInventoryItemby the givenQuantity.getId()protected abstract ProductReturns theProductthisInventoryItembelongs to.booleanhasSufficientQuantity(Quantity quantity) Returns whether theInventoryItemis available in exactly or more of the given quantity.increaseQuantity(Quantity quantity) Increases the quantity of the currentInventoryItemby the givenQuantity.booleankeepsTrackOf(Product product) Returns whether theInventoryItembelongs to the givenProduct.toString()Methods inherited from class org.salespointframework.core.AbstractAggregateRoot
registerEventMethods inherited from class org.salespointframework.core.AbstractEntity
equals, hashCode, hasId, isNew
-
Constructor Details
-
InventoryItem
- Parameters:
quantity- the initialQuantityfor thisInventoryItem, must not be null.
-
-
Method Details
-
getId
-
hasSufficientQuantity
Returns whether theInventoryItemis available in exactly or more of the given quantity.- Parameters:
quantity- must not be null.- Returns:
-
decreaseQuantity
Decreases the quantity of the currentInventoryItemby the givenQuantity.- Parameters:
quantity- must not be null.
-
increaseQuantity
Increases the quantity of the currentInventoryItemby the givenQuantity.- Parameters:
quantity- must not be null.
-
keepsTrackOf
Returns whether theInventoryItembelongs to the givenProduct.- Parameters:
product- must not be null.- Returns:
-
getProduct
Returns theProductthisInventoryItembelongs to.- Returns:
- must not be null.
-
toString
-
getQuantity
-