public interface Product extends ProductLike<Product,Product>, Resource<Product>
A sellable good.
Consider to use ProductProjection
for queries if you don't need the whole product data so you can safe traffic and memory.
Modifier and Type | Method and Description |
---|---|
ProductCatalogData |
getMasterData() |
ReviewRatingStatistics |
getReviewRatingStatistics() |
Reference<State> |
getState()
Returns this state of this Product.
|
static Reference<Product> |
reference(Product product) |
static Reference<Product> |
reference(String id) |
static Reference<Product> |
referenceOfId(String id)
Creates a reference for one item of this class by a known ID.
|
static String |
referenceTypeId()
A type hint for references which resource type is linked in a reference.
|
static String |
resourceTypeId() |
default ProductProjection |
toProjection(ProductProjectionType productProjectionType) |
default Reference<Product> |
toReference()
Creates a reference to this resource, the reference may not be filled.
|
static com.fasterxml.jackson.core.type.TypeReference<Product> |
typeReference()
Creates a container which contains the full Java type information to deserialize this class from JSON.
|
getKey, getProductType, getTaxCategory
getId
getCreatedAt, getId, getLastModifiedAt, getVersion
hasSameIdAs, toResourceIdentifier
ProductCatalogData getMasterData()
@Nullable Reference<State> getState()
getState
in interface ProductLike<Product,Product>
TransitionState
static com.fasterxml.jackson.core.type.TypeReference<Product> typeReference()
default Reference<Product> toReference()
Referenceable
toReference
in interface Referenceable<Product>
toReference
in interface Resource<Product>
static String referenceTypeId()
Reference.getTypeId()
static String resourceTypeId()
@Nullable default ProductProjection toProjection(ProductProjectionType productProjectionType)
static Reference<Product> referenceOfId(String id)
An example for categories but this applies for other resources, too:
final String categoryIdFromFormOrSession = "84ac4271-0fec-49d0-9fee-55586c565c58"; final Reference<Category> categoryReference = Category.referenceOfId(categoryIdFromFormOrSession); assertThat(categoryReference.getId()).isEqualTo(categoryIdFromFormOrSession);
See the test code.
If you already have a resource object, then use toReference()
instead:
final Category category = getCategory1(); final Reference<Category> categoryReference = category.toReference(); assertThat(category.getId()).isEqualTo(categoryReference.getId());
See the test code.
id
- the ID of the resource which should be referenced.@Nullable ReviewRatingStatistics getReviewRatingStatistics()
getReviewRatingStatistics
in interface ProductLike<Product,Product>