Package org.salespointframework.catalog
Class Product
- java.lang.Object
- 
- org.salespointframework.core.AbstractEntity<ProductIdentifier>
- 
- org.salespointframework.catalog.Product
 
 
- 
- All Implemented Interfaces:
- Comparable<Product>,- org.springframework.data.domain.Persistable<ProductIdentifier>
 
 @Entity public class Product extends AbstractEntity<ProductIdentifier> implements Comparable<Product> A product.- Author:
- Paul Henke, Oliver Gierke
 
- 
- 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddCategory(String category)Adds theProductto the given category.intcompareTo(Product other)QuantitycreateQuantity(double amount)QuantitycreateQuantity(long amount)org.springframework.data.util.Streamable<String>getCategories()Returns the categories theProductis assigned to.ProductIdentifiergetId()@NonNull StringgetName()@NonNull javax.money.MonetaryAmountgetPrice()booleanremoveCategory(String category)voidsetName(@NonNull String name)voidsetPrice(@NonNull javax.money.MonetaryAmount price)booleansupports(Quantity quantity)StringtoString()voidverify(Quantity quantity)- 
Methods inherited from class org.salespointframework.core.AbstractEntityequals, hashCode, isNew
 
- 
 
- 
- 
- 
Constructor Detail- 
Productpublic Product(String name, javax.money.MonetaryAmount price) Creates a newProductwith the given name and price.- Parameters:
- name- must not be null or empty.
- price- must not be null.
 
 - 
Productprotected Product() 
 
- 
 - 
Method Detail- 
getIdpublic ProductIdentifier getId() - Specified by:
- getIdin interface- org.springframework.data.domain.Persistable<ProductIdentifier>
 
 - 
getCategoriespublic org.springframework.data.util.Streamable<String> getCategories() Returns the categories theProductis assigned to.- Returns:
- will never be null.
 
 - 
addCategorypublic final boolean addCategory(String category) Adds theProductto the given category.- Parameters:
- category- must not be null or empty.
- Returns:
 
 - 
removeCategorypublic final boolean removeCategory(String category) 
 - 
supportspublic boolean supports(Quantity quantity) - Parameters:
- quantity-
- Returns:
 
 - 
verifypublic void verify(Quantity quantity) - Parameters:
- quantity-
- Throws:
- MetricMismatchException- in case the- Productdoes not support the given- Quantity.
 
 - 
createQuantitypublic Quantity createQuantity(double amount) - Parameters:
- amount- must not be null.
- Returns:
 
 - 
createQuantitypublic Quantity createQuantity(long amount) - Parameters:
- amount- must not be null.
- Returns:
 
 - 
compareTopublic int compareTo(Product other) - Specified by:
- compareToin interface- Comparable<Product>
 
 - 
getName@NonNull public @NonNull String getName() 
 - 
setNamepublic void setName(@NonNull @NonNull String name)
 - 
getPrice@NonNull public @NonNull javax.money.MonetaryAmount getPrice() 
 - 
setPricepublic void setPrice(@NonNull @NonNull javax.money.MonetaryAmount price)
 
- 
 
-