Package org.salespointframework.catalog
Class Product
java.lang.Object
org.salespointframework.core.AbstractEntity<ID>
org.salespointframework.core.AbstractAggregateRoot<ProductIdentifier>
org.salespointframework.catalog.Product
- All Implemented Interfaces:
Comparable<Product>,Persistable<ProductIdentifier>
@Entity public class Product extends AbstractAggregateRoot<ProductIdentifier> implements Comparable<Product>
A product.
- Author:
- Paul Henke, Oliver Gierke
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description booleanaddCategory(String category)Adds theProductto the given category.intcompareTo(Product other)QuantitycreateQuantity(double amount)QuantitycreateQuantity(long amount)Streamable<String>getCategories()Returns the categories theProductis assigned to.ProductIdentifiergetId()@NonNull StringgetName()@NonNull javax.money.MonetaryAmountgetPrice()booleanremoveCategory(String category)ProductsetName(@NonNull String name)ProductsetPrice(@NonNull javax.money.MonetaryAmount price)booleansupports(Quantity quantity)StringtoString()voidverify(Quantity quantity)Methods inherited from class org.salespointframework.core.AbstractEntity
equals, hashCode, hasId, isNew
-
Constructor Details
-
Method Details
-
getId
- Specified by:
getIdin interfacePersistable<ProductIdentifier>
-
getCategories
Returns the categories theProductis assigned to.- Returns:
- will never be null.
-
addCategory
Adds theProductto the given category.- Parameters:
category- must not be null or empty.- Returns:
-
removeCategory
-
supports
- Parameters:
quantity-- Returns:
-
verify
- Parameters:
quantity-- Throws:
MetricMismatchException- in case theProductdoes not support the givenQuantity.
-
createQuantity
- Parameters:
amount- must not be null.- Returns:
-
createQuantity
- Parameters:
amount- must not be null.- Returns:
-
compareTo
- Specified by:
compareToin interfaceComparable<Product>
-
toString
-
getName
-
setName
-
getPrice
@NonNull public @NonNull javax.money.MonetaryAmount getPrice() -
setPrice
-