Interface ProductVariant
- All Superinterfaces:
AttributeContainer
,WithKey
A concrete sellable good for which inventory can be tracked. Product Variants are generally mapped to specific SKUs.
Example to create an instance using the builder pattern
ProductVariant productVariant = ProductVariant.builder()
.id(0.3)
.build()
-
Method Summary
Modifier and TypeMethodDescriptionstatic ProductVariantBuilder
builder()
builder factory method for ProductVariantstatic ProductVariantBuilder
builder
(ProductVariant template) create builder for ProductVariant instancestatic ProductVariant
deepCopy
(ProductVariant template) factory method to create a deep copy of ProductVariantMedia assets of the Product Variant.Attributes of the Product Variant.@Valid ProductVariantAvailability
Set if the Product Variant is tracked by Inventory.@NotNull Long
getId()
A unique, sequential identifier of the Product Variant within the Product.Images of the Product Variant.true
if the Product Variant matches the search query.getKey()
User-defined unique identifier of the ProductVariant.@Valid Price
getPrice()
Only available when price selection is used.The Embedded Prices of the Product Variant.@Valid ScopedPrice
Only available in response to a Product Projection Search request with Product price selection.Only available in response to a Product Projection Search request with Product price selection.getSku()
User-defined unique SKU of the Product Variant.static ProductVariant
of()
factory methodstatic ProductVariant
of
(ProductVariant template) factory method to create a shallow copy ProductVariantvoid
Media assets of the Product Variant.void
Media assets of the Product Variant.void
setAttributes
(Attribute... attributes) Attributes of the Product Variant.void
setAttributes
(List<Attribute> attributes) Attributes of the Product Variant.void
setAvailability
(ProductVariantAvailability availability) Set if the Product Variant is tracked by Inventory.void
A unique, sequential identifier of the Product Variant within the Product.void
Images of the Product Variant.void
Images of the Product Variant.void
setIsMatchingVariant
(Boolean isMatchingVariant) true
if the Product Variant matches the search query.void
User-defined unique identifier of the ProductVariant.void
Only available when price selection is used.void
The Embedded Prices of the Product Variant.void
The Embedded Prices of the Product Variant.void
setScopedPrice
(ScopedPrice scopedPrice) Only available in response to a Product Projection Search request with Product price selection.void
setScopedPriceDiscounted
(Boolean scopedPriceDiscounted) Only available in response to a Product Projection Search request with Product price selection.void
User-defined unique SKU of the Product Variant.static com.fasterxml.jackson.core.type.TypeReference<ProductVariant>
gives a TypeReference for usage with Jackson DataBinddefault <T> T
withProductVariant
(Function<ProductVariant, T> helper) accessor map functionMethods inherited from interface com.commercetools.api.models.product.AttributeContainer
findAttribute, findAttribute, findAttributeByName, getAttribute, getAttributeByName, hasAttribute
-
Method Details
-
getId
A unique, sequential identifier of the Product Variant within the Product.
- Returns:
- id
-
getSku
String getSku()User-defined unique SKU of the Product Variant.
- Returns:
- sku
-
getKey
String getKey()User-defined unique identifier of the ProductVariant.
This is different from Product
key
. -
getPrices
The Embedded Prices of the Product Variant. Cannot contain two Prices of the same Price scope (with same currency, country, Customer Group, Channel,
validFrom
andvalidUntil
).- Returns:
- prices
-
getAttributes
Attributes of the Product Variant.
- Specified by:
getAttributes
in interfaceAttributeContainer
- Returns:
- attributes
-
getPrice
Only available when price selection is used. Cannot be used in a Query Predicate.
- Returns:
- price
-
getImages
Images of the Product Variant.
- Returns:
- images
-
getAssets
Media assets of the Product Variant.
- Returns:
- assets
-
getAvailability
Set if the Product Variant is tracked by Inventory. Can be used as an optimization to reduce calls to the Inventory service. May not contain the latest Inventory State (it is eventually consistent).
- Returns:
- availability
-
getIsMatchingVariant
Boolean getIsMatchingVariant()true
if the Product Variant matches the search query. Only available in response to a Product Projection Search request.- Returns:
- isMatchingVariant
-
getScopedPrice
Only available in response to a Product Projection Search request with Product price selection. Can be used to sort, filter, and facet.
- Returns:
- scopedPrice
-
getScopedPriceDiscounted
Boolean getScopedPriceDiscounted()Only available in response to a Product Projection Search request with Product price selection.
- Returns:
- scopedPriceDiscounted
-
setId
A unique, sequential identifier of the Product Variant within the Product.
- Parameters:
id
- value to be set
-
setSku
User-defined unique SKU of the Product Variant.
- Parameters:
sku
- value to be set
-
setKey
User-defined unique identifier of the ProductVariant.
This is different from Product
key
.- Parameters:
key
- value to be set
-
setPrices
The Embedded Prices of the Product Variant. Cannot contain two Prices of the same Price scope (with same currency, country, Customer Group, Channel,
validFrom
andvalidUntil
).- Parameters:
prices
- values to be set
-
setPrices
The Embedded Prices of the Product Variant. Cannot contain two Prices of the same Price scope (with same currency, country, Customer Group, Channel,
validFrom
andvalidUntil
).- Parameters:
prices
- values to be set
-
setAttributes
Attributes of the Product Variant.
- Parameters:
attributes
- values to be set
-
setAttributes
Attributes of the Product Variant.
- Parameters:
attributes
- values to be set
-
setPrice
Only available when price selection is used. Cannot be used in a Query Predicate.
- Parameters:
price
- value to be set
-
setImages
Images of the Product Variant.
- Parameters:
images
- values to be set
-
setImages
Images of the Product Variant.
- Parameters:
images
- values to be set
-
setAssets
Media assets of the Product Variant.
- Parameters:
assets
- values to be set
-
setAssets
Media assets of the Product Variant.
- Parameters:
assets
- values to be set
-
setAvailability
Set if the Product Variant is tracked by Inventory. Can be used as an optimization to reduce calls to the Inventory service. May not contain the latest Inventory State (it is eventually consistent).
- Parameters:
availability
- value to be set
-
setIsMatchingVariant
true
if the Product Variant matches the search query. Only available in response to a Product Projection Search request.- Parameters:
isMatchingVariant
- value to be set
-
setScopedPrice
Only available in response to a Product Projection Search request with Product price selection. Can be used to sort, filter, and facet.
- Parameters:
scopedPrice
- value to be set
-
setScopedPriceDiscounted
Only available in response to a Product Projection Search request with Product price selection.
- Parameters:
scopedPriceDiscounted
- value to be set
-
of
factory method- Returns:
- instance of ProductVariant
-
of
factory method to create a shallow copy ProductVariant- Parameters:
template
- instance to be copied- Returns:
- copy instance
-
deepCopy
factory method to create a deep copy of ProductVariant- Parameters:
template
- instance to be copied- Returns:
- copy instance
-
builder
builder factory method for ProductVariant- Returns:
- builder
-
builder
create builder for ProductVariant instance- Parameters:
template
- instance with prefilled values for the builder- Returns:
- builder
-
withProductVariant
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
-