Interface VariantAttributes
A lightweight representation of a Product's Variants with only the requested Attributes and minimal availability data. Designed for building attribute selectors on product detail pages (PDPs).
Example to create an instance using the builder pattern
VariantAttributes variantAttributes = VariantAttributes.builder()
.productId("{productId}")
.plusAttributes(attributesBuilder -> attributesBuilder)
.plusVariants(variantsBuilder -> variantsBuilder)
.build()
-
Method Summary
Modifier and TypeMethodDescriptionstatic VariantAttributesBuilderbuilder()builder factory method for VariantAttributesstatic VariantAttributesBuilderbuilder(VariantAttributes template) create builder for VariantAttributes instancecopyDeep()static VariantAttributesdeepCopy(VariantAttributes template) factory method to create a deep copy of VariantAttributes@NotNull @Valid List<VariantAttributesAttributeMetadata>Metadata for the requested Attributes, derived from the ProductType.@NotNull StringUnique identifier of the Product.User-defined unique identifier of the Product.@NotNull @Valid List<VariantAttributesVariant>All Variants of the Product with their requested Attributes and availability.static VariantAttributesof()factory methodstatic VariantAttributesof(VariantAttributes template) factory method to create a shallow copy VariantAttributesvoidsetAttributes(VariantAttributesAttributeMetadata... attributes) Metadata for the requested Attributes, derived from the ProductType.voidsetAttributes(List<VariantAttributesAttributeMetadata> attributes) Metadata for the requested Attributes, derived from the ProductType.voidsetProductId(String productId) Unique identifier of the Product.voidsetProductKey(String productKey) User-defined unique identifier of the Product.voidsetVariants(VariantAttributesVariant... variants) All Variants of the Product with their requested Attributes and availability.voidsetVariants(List<VariantAttributesVariant> variants) All Variants of the Product with their requested Attributes and availability.static tools.jackson.core.type.TypeReference<VariantAttributes>gives a TypeReference for usage with Jackson DataBinddefault <T> TwithVariantAttributes(Function<VariantAttributes, T> helper) accessor map function
-
Method Details
-
getProductId
Unique identifier of the Product.
- Returns:
- productId
-
getProductKey
String getProductKey()User-defined unique identifier of the Product.
- Returns:
- productKey
-
getAttributes
Metadata for the requested Attributes, derived from the ProductType. Attributes not found in the ProductType are silently omitted.
- Returns:
- attributes
-
getVariants
All Variants of the Product with their requested Attributes and availability.
- Returns:
- variants
-
setProductId
Unique identifier of the Product.
- Parameters:
productId- value to be set
-
setProductKey
User-defined unique identifier of the Product.
- Parameters:
productKey- value to be set
-
setAttributes
Metadata for the requested Attributes, derived from the ProductType. Attributes not found in the ProductType are silently omitted.
- Parameters:
attributes- values to be set
-
setAttributes
Metadata for the requested Attributes, derived from the ProductType. Attributes not found in the ProductType are silently omitted.
- Parameters:
attributes- values to be set
-
setVariants
All Variants of the Product with their requested Attributes and availability.
- Parameters:
variants- values to be set
-
setVariants
All Variants of the Product with their requested Attributes and availability.
- Parameters:
variants- values to be set
-
of
factory method- Returns:
- instance of VariantAttributes
-
of
factory method to create a shallow copy VariantAttributes- Parameters:
template- instance to be copied- Returns:
- copy instance
-
copyDeep
VariantAttributes copyDeep() -
deepCopy
factory method to create a deep copy of VariantAttributes- Parameters:
template- instance to be copied- Returns:
- copy instance
-
builder
builder factory method for VariantAttributes- Returns:
- builder
-
builder
create builder for VariantAttributes instance- Parameters:
template- instance with prefilled values for the builder- Returns:
- builder
-
withVariantAttributes
accessor map function- Type Parameters:
T- mapped type- Parameters:
helper- function to map the object- Returns:
- mapped value
-
typeReference
gives a TypeReference for usage with Jackson DataBind- Returns:
- TypeReference
-