Interface VariantProjection
A lightweight, read-only projection of a single Variant with embedded Product data. Variant Projections are automatically created and updated when Variants or their parent Products change.
Example to create an instance using the builder pattern
VariantProjection variantProjection = VariantProjection.builder()
.id("{id}")
.version(0.3)
.createdAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
.staged(true)
.variantId(0.3)
.product(productBuilder -> productBuilder)
.name(nameBuilder -> nameBuilder)
.slug(slugBuilder -> slugBuilder)
.plusImages(imagesBuilder -> imagesBuilder)
.plusAssets(assetsBuilder -> assetsBuilder)
.plusAttributes(attributesBuilder -> attributesBuilder)
.default(true)
.build()
-
Method Summary
Modifier and TypeMethodDescriptionstatic VariantProjectionBuilderbuilder()builder factory method for VariantProjectionstatic VariantProjectionBuilderbuilder(VariantProjection template) create builder for VariantProjection instancecopyDeep()static VariantProjectiondeepCopy(VariantProjection template) factory method to create a deep copy of VariantProjectionAssets of the Variant.Attributes of the Variant, including product-level Attributes merged at projection time.@NotNull ZonedDateTimeDate and time (UTC) the Variant Projection was initially created.@NotNull Boolean@Valid LocalizedStringDescription of the parent Product.@NotNull StringgetId()Unique identifier of the Variant within its parent Product.Images of the Variant.getKey()User-defined unique identifier of the Variant.@NotNull @Valid LocalizedStringgetName()Name of the parent Product.@Valid PricegetPrice()The selected price based on the price selection query parameters.@NotNull @Valid ProductReferencegetSku()SKU of the Variant.@NotNull @Valid LocalizedStringgetSlug()Slug of the parent Product.@NotNull Booleantruefor the staged (draft) projection,falsefor the current (published) projection.@NotNull IntegerTheidof the Variant.@NotNull LongCurrent version of the Variant Projection.static VariantProjectionof()factory methodstatic VariantProjectionof(VariantProjection template) factory method to create a shallow copy VariantProjectionvoidAssets of the Variant.voidAssets of the Variant.voidsetAttributes(Attribute... attributes) Attributes of the Variant, including product-level Attributes merged at projection time.voidsetAttributes(List<Attribute> attributes) Attributes of the Variant, including product-level Attributes merged at projection time.voidsetCreatedAt(ZonedDateTime createdAt) Date and time (UTC) the Variant Projection was initially created.voidsetDefault(Boolean _default) voidsetDescription(LocalizedString description) Description of the parent Product.voidUnique identifier of the Variant within its parent Product.voidImages of the Variant.voidImages of the Variant.voidUser-defined unique identifier of the Variant.voidsetName(LocalizedString name) Name of the parent Product.voidThe selected price based on the price selection query parameters.voidsetProduct(ProductReference product) voidSKU of the Variant.voidsetSlug(LocalizedString slug) Slug of the parent Product.voidtruefor the staged (draft) projection,falsefor the current (published) projection.voidsetVariantId(Integer variantId) Theidof the Variant.voidsetVersion(Long version) Current version of the Variant Projection.static tools.jackson.core.type.TypeReference<VariantProjection>gives a TypeReference for usage with Jackson DataBinddefault <T> TwithVariantProjection(Function<VariantProjection, T> helper) accessor map function
-
Method Details
-
getId
Unique identifier of the Variant within its parent Product.
- Returns:
- id
-
getVersion
Current version of the Variant Projection.
- Returns:
- version
-
getCreatedAt
Date and time (UTC) the Variant Projection was initially created.
- Returns:
- createdAt
-
getStaged
truefor the staged (draft) projection,falsefor the current (published) projection.- Returns:
- staged
-
getVariantId
The
idof the Variant.- Returns:
- variantId
-
getProduct
- Returns:
- product
-
getName
Name of the parent Product.
- Returns:
- name
-
getSlug
Slug of the parent Product.
- Returns:
- slug
-
getDescription
Description of the parent Product.
- Returns:
- description
-
getKey
String getKey()User-defined unique identifier of the Variant.
- Returns:
- key
-
getSku
String getSku()SKU of the Variant.
- Returns:
- sku
-
getImages
Images of the Variant.
- Returns:
- images
-
getAssets
Assets of the Variant.
- Returns:
- assets
-
getAttributes
Attributes of the Variant, including product-level Attributes merged at projection time.
- Returns:
- attributes
-
getPrice
The selected price based on the price selection query parameters. Only present when price selection parameters are provided.
- Returns:
- price
-
getDefault
trueif this Variant is the default Variant of its Product (see Product.defaultVariant).falseotherwise.- Returns:
- default
-
setId
Unique identifier of the Variant within its parent Product.
- Parameters:
id- value to be set
-
setVersion
Current version of the Variant Projection.
- Parameters:
version- value to be set
-
setCreatedAt
Date and time (UTC) the Variant Projection was initially created.
- Parameters:
createdAt- value to be set
-
setStaged
truefor the staged (draft) projection,falsefor the current (published) projection.- Parameters:
staged- value to be set
-
setVariantId
The
idof the Variant.- Parameters:
variantId- value to be set
-
setProduct
- Parameters:
product- value to be set
-
setName
Name of the parent Product.
- Parameters:
name- value to be set
-
setSlug
Slug of the parent Product.
- Parameters:
slug- value to be set
-
setDescription
Description of the parent Product.
- Parameters:
description- value to be set
-
setKey
User-defined unique identifier of the Variant.
- Parameters:
key- value to be set
-
setSku
SKU of the Variant.
- Parameters:
sku- value to be set
-
setImages
Images of the Variant.
- Parameters:
images- values to be set
-
setImages
Images of the Variant.
- Parameters:
images- values to be set
-
setAssets
Assets of the Variant.
- Parameters:
assets- values to be set
-
setAssets
Assets of the Variant.
- Parameters:
assets- values to be set
-
setAttributes
Attributes of the Variant, including product-level Attributes merged at projection time.
- Parameters:
attributes- values to be set
-
setAttributes
Attributes of the Variant, including product-level Attributes merged at projection time.
- Parameters:
attributes- values to be set
-
setPrice
The selected price based on the price selection query parameters. Only present when price selection parameters are provided.
- Parameters:
price- value to be set
-
setDefault
trueif this Variant is the default Variant of its Product (see Product.defaultVariant).falseotherwise.- Parameters:
_default- value to be set
-
of
factory method- Returns:
- instance of VariantProjection
-
of
factory method to create a shallow copy VariantProjection- Parameters:
template- instance to be copied- Returns:
- copy instance
-
copyDeep
VariantProjection copyDeep() -
deepCopy
factory method to create a deep copy of VariantProjection- Parameters:
template- instance to be copied- Returns:
- copy instance
-
builder
builder factory method for VariantProjection- Returns:
- builder
-
builder
create builder for VariantProjection instance- Parameters:
template- instance with prefilled values for the builder- Returns:
- builder
-
withVariantProjection
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
-