@Entity public class InventoryItem extends AbstractEntity<InventoryItemIdentifier>
Modifier | Constructor and Description |
---|---|
protected |
InventoryItem() |
|
InventoryItem(Product product,
Quantity quantity)
|
Modifier and Type | Method and Description |
---|---|
InventoryItem |
decreaseQuantity(Quantity quantity)
Decreases the quantity of the current
InventoryItem by the given Quantity . |
InventoryItemIdentifier |
getId() |
Product |
getProduct() |
Quantity |
getQuantity() |
boolean |
hasSufficientQuantity(Quantity quantity)
Returns whether the
InventoryItem is available in exactly or more of the given quantity. |
InventoryItem |
increaseQuantity(Quantity quantity)
Increases the quantity of the current
InventoryItem by the given Quantity . |
equals, hashCode, isNew
public InventoryItem(Product product, Quantity quantity)
product
- the Product
for this InventoryItem
, must not be null.quantity
- the initial Quantity
for this InventoryItem
, must not be null.protected InventoryItem()
public final InventoryItemIdentifier getId()
public boolean hasSufficientQuantity(Quantity quantity)
InventoryItem
is available in exactly or more of the given quantity.quantity
- must not be null.public InventoryItem decreaseQuantity(Quantity quantity)
InventoryItem
by the given Quantity
.quantity
- must not be null.public InventoryItem increaseQuantity(Quantity quantity)
InventoryItem
by the given Quantity
.quantity
- must not be null.public Product getProduct()
public Quantity getQuantity()
Copyright © 2019. All rights reserved.