Interface ProductDataLike
- All Superinterfaces:
MetaAttributes
,WithLocalizedSlug
- All Known Subinterfaces:
ProductData
,ProductProjection
,ProductProjectionMixin
Interface to describe commonalities between differen product representations
-
Method Summary
Modifier and TypeMethodDescriptiondefault Optional<ProductVariant>
findVariantBySku
(String sku) Finds a variant by SKU.default List<ProductVariant>
Gets all variants in the product including the master variant as first element in the list.Returns the master variant.getName()
getSlug()
default ProductVariant
getVariant
(long variantId) Finds a product variant by id.default ProductVariant
getVariantOrMaster
(long variantId) Finds a product variant by id and returns the master variant if not variant with the id is present.Gets the variants which are not identical to the master variant.
-
Method Details
-
getName
LocalizedString getName() -
getCategories
List<CategoryReference> getCategories() -
getDescription
-
getSlug
LocalizedString getSlug()- Specified by:
getSlug
in interfaceWithLocalizedSlug
-
getMetaTitle
- Specified by:
getMetaTitle
in interfaceMetaAttributes
-
getMetaDescription
- Specified by:
getMetaDescription
in interfaceMetaAttributes
-
getMetaKeywords
- Specified by:
getMetaKeywords
in interfaceMetaAttributes
-
getMasterVariant
ProductVariant getMasterVariant()Returns the master variant. Every product as 1 to n variants, so this is always present.- Returns:
- the main variant in the product
- See Also:
-
getVariants
List<ProductVariant> getVariants()Gets the variants which are not identical to the master variant. This list can be empty.- Returns:
- all variants except the one in
getMasterVariant()
- See Also:
-
getAllVariants
Gets all variants in the product including the master variant as first element in the list.- Returns:
- all variants
- See Also:
-
getVariant
Finds a product variant by id.- Parameters:
variantId
- the id of the variant to find- Returns:
- variant or null if no variant exists with
id
-
getVariantOrMaster
Finds a product variant by id and returns the master variant if not variant with the id is present.- Parameters:
variantId
- the id of the variant to find- Returns:
- a variant
-
findVariantBySku
Finds a variant by SKU.- Parameters:
sku
- the sku for the variant- Returns:
- Optional of the found variant
-
getSearchKeywords
SearchKeywords getSearchKeywords() -
getCategoryOrderHints
-