@Entity public class InventoryItem extends AbstractEntity<InventoryItemIdentifier>
Modifier | Constructor and Description |
---|---|
protected |
InventoryItem() |
|
InventoryItem(Product product,
Quantity quantity)
|
Modifier and Type | Method and Description |
---|---|
void |
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. |
void |
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.@Generated(value="lombok") 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 void decreaseQuantity(Quantity quantity)
InventoryItem
by the given Quantity
.quantity
- must not be null.public void increaseQuantity(Quantity quantity)
InventoryItem
by the given Quantity
.quantity
- must not be null.@Generated(value="lombok") public Product getProduct()
@Generated(value="lombok") public Quantity getQuantity()
Copyright © 2018 Pivotal Software, Inc.. All rights reserved.