Interface Variant
- All Superinterfaces:
BaseResource
A Variant represents a single Variant with both current (published) and staged (draft) data. Variants are writable resources that support create, update, and delete operations.
Example to create an instance using the builder pattern
Variant variant = Variant.builder()
.id("{id}")
.version(0.3)
.createdAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
.lastModifiedAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
.variantId(0.3)
.product(productBuilder -> productBuilder)
.published(true)
.current(currentBuilder -> currentBuilder)
.build()
-
Method Summary
Modifier and TypeMethodDescriptionstatic VariantBuilderbuilder()builder factory method for Variantstatic VariantBuildercreate builder for Variant instancecopyDeep()static Variantfactory method to create a deep copy of Variant@NotNull ZonedDateTimeDate and time (UTC) the Variant was initially created.@Valid CreatedByIDs and references that created the Variant.@NotNull @Valid VariantDataThe current data of the Variant.@NotNull StringgetId()Unique identifier of the Variant.getKey()User-defined unique identifier of the Variant.@NotNull ZonedDateTimeDate and time (UTC) the Variant was last updated.@Valid LastModifiedByIDs and references that last modified the Variant.@NotNull @Valid ProductReferenceReference to the parent Product the Variant belongs to.@NotNull Booleantrueif the Variant is published,falseif it is unpublished.@Valid VariantDataThe staged data of the Variant.@NotNull IntegerA unique, sequential identifier of the Variant within the parent Product.@NotNull LongCurrent version of the Variant.static Variantof()factory methodstatic Variantfactory method to create a shallow copy VariantvoidsetCreatedAt(ZonedDateTime createdAt) Date and time (UTC) the Variant was initially created.voidsetCreatedBy(CreatedBy createdBy) IDs and references that created the Variant.voidsetCurrent(VariantData current) The current data of the Variant.voidUnique identifier of the Variant.voidUser-defined unique identifier of the Variant.voidsetLastModifiedAt(ZonedDateTime lastModifiedAt) Date and time (UTC) the Variant was last updated.voidsetLastModifiedBy(LastModifiedBy lastModifiedBy) IDs and references that last modified the Variant.voidsetProduct(ProductReference product) Reference to the parent Product the Variant belongs to.voidsetPublished(Boolean published) trueif the Variant is published,falseif it is unpublished.voidsetStaged(VariantData staged) The staged data of the Variant.voidsetVariantId(Integer variantId) A unique, sequential identifier of the Variant within the parent Product.voidsetVersion(Long version) Current version of the Variant.static tools.jackson.core.type.TypeReference<Variant>gives a TypeReference for usage with Jackson DataBinddefault <T> TwithVariant(Function<Variant, T> helper) accessor map functionMethods inherited from interface com.commercetools.api.models.common.BaseResource
withBaseResource
-
Method Details
-
getId
Unique identifier of the Variant.
- Specified by:
getIdin interfaceBaseResource- Returns:
- id
-
getVersion
Current version of the Variant.
- Specified by:
getVersionin interfaceBaseResource- Returns:
- version
-
getCreatedAt
Date and time (UTC) the Variant was initially created.
- Specified by:
getCreatedAtin interfaceBaseResource- Returns:
- createdAt
-
getLastModifiedAt
Date and time (UTC) the Variant was last updated.
- Specified by:
getLastModifiedAtin interfaceBaseResource- Returns:
- lastModifiedAt
-
getLastModifiedBy
IDs and references that last modified the Variant.
- Returns:
- lastModifiedBy
-
getCreatedBy
IDs and references that created the Variant.
- Returns:
- createdBy
-
getKey
String getKey()User-defined unique identifier of the Variant. This is different from Product
key.- Returns:
- key
-
getVariantId
A unique, sequential identifier of the Variant within the parent Product.
- Returns:
- variantId
-
getProduct
Reference to the parent Product the Variant belongs to.
- Returns:
- product
-
getPublished
trueif the Variant is published,falseif it is unpublished.- Returns:
- published
-
getCurrent
The current data of the Variant.
- Returns:
- current
-
getStaged
The staged data of the Variant. Only present if there are staged changes that differ from the current data.
- Returns:
- staged
-
setId
Unique identifier of the Variant.
- Specified by:
setIdin interfaceBaseResource- Parameters:
id- value to be set
-
setVersion
Current version of the Variant.
- Specified by:
setVersionin interfaceBaseResource- Parameters:
version- value to be set
-
setCreatedAt
Date and time (UTC) the Variant was initially created.
- Specified by:
setCreatedAtin interfaceBaseResource- Parameters:
createdAt- value to be set
-
setLastModifiedAt
Date and time (UTC) the Variant was last updated.
- Specified by:
setLastModifiedAtin interfaceBaseResource- Parameters:
lastModifiedAt- value to be set
-
setLastModifiedBy
IDs and references that last modified the Variant.
- Parameters:
lastModifiedBy- value to be set
-
setCreatedBy
IDs and references that created the Variant.
- Parameters:
createdBy- value to be set
-
setKey
User-defined unique identifier of the Variant. This is different from Product
key.- Parameters:
key- value to be set
-
setVariantId
A unique, sequential identifier of the Variant within the parent Product.
- Parameters:
variantId- value to be set
-
setProduct
Reference to the parent Product the Variant belongs to.
- Parameters:
product- value to be set
-
setPublished
trueif the Variant is published,falseif it is unpublished.- Parameters:
published- value to be set
-
setCurrent
The current data of the Variant.
- Parameters:
current- value to be set
-
setStaged
The staged data of the Variant. Only present if there are staged changes that differ from the current data.
- Parameters:
staged- value to be set
-
of
factory method- Returns:
- instance of Variant
-
of
factory method to create a shallow copy Variant- Parameters:
template- instance to be copied- Returns:
- copy instance
-
copyDeep
Variant copyDeep()- Specified by:
copyDeepin interfaceBaseResource
-
deepCopy
factory method to create a deep copy of Variant- Parameters:
template- instance to be copied- Returns:
- copy instance
-
builder
builder factory method for Variant- Returns:
- builder
-
builder
create builder for Variant instance- Parameters:
template- instance with prefilled values for the builder- Returns:
- builder
-
withVariant
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
-