Class ProductVariantBuilder
- All Implemented Interfaces:
Builder<ProductVariant>
Example to create an instance using the builder pattern
ProductVariant productVariant = ProductVariant.builder()
.id(0.3)
.build()
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddAssets
(Function<AssetBuilder, Asset> builder) Media assets of the Product Variant.addAttributes
(Function<AttributeBuilder, Attribute> builder) Attributes of the Product Variant.addImages
(Function<ImageBuilder, Image> builder) Images of the Product Variant.addPrices
(Function<PriceBuilder, Price> builder) The Embedded Prices of the Product Variant.Media assets of the Product Variant.Media assets of the Product Variant.attributes
(Attribute... attributes) Attributes of the Product Variant.attributes
(List<Attribute> attributes) Attributes of the Product Variant.availability
(ProductVariantAvailability availability) Set if the Product Variant is tracked by Inventory.Set if the Product Variant is tracked by Inventory.build()
builds ProductVariant with checking for non-null required valuesbuilds ProductVariant without checking for non-null required valuesMedia assets of the Product Variant.Attributes of the Product Variant.Set if the Product Variant is tracked by Inventory.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.getPrice()
Only available when price selection is used.The Embedded Prices of the Product Variant.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.A unique, sequential identifier of the Product Variant within the Product.Images of the Product Variant.Images of the Product Variant.isMatchingVariant
(Boolean isMatchingVariant) true
if the Product Variant matches the search query.User-defined unique identifier of the ProductVariant.static ProductVariantBuilder
of()
factory method for an instance of ProductVariantBuilderstatic ProductVariantBuilder
of
(ProductVariant template) create builder for ProductVariant instanceplusAssets
(Asset... assets) Media assets of the Product Variant.plusAssets
(Function<AssetBuilder, AssetBuilder> builder) Media assets of the Product Variant.plusAttributes
(Attribute... attributes) Attributes of the Product Variant.Attributes of the Product Variant.plusImages
(Image... images) Images of the Product Variant.plusImages
(Function<ImageBuilder, ImageBuilder> builder) Images of the Product Variant.plusPrices
(Price... prices) The Embedded Prices of the Product Variant.plusPrices
(Function<PriceBuilder, PriceBuilder> builder) The Embedded Prices of the Product Variant.Only available when price selection is used.price
(Function<PriceBuilder, PriceBuilder> builder) Only available when price selection is used.The Embedded Prices of the Product Variant.The Embedded Prices of the Product Variant.scopedPrice
(ScopedPrice 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.scopedPriceDiscounted
(Boolean scopedPriceDiscounted) Only available in response to a Product Projection Search request with Product price selection.setAssets
(Function<AssetBuilder, Asset> builder) Media assets of the Product Variant.setAttributes
(Function<AttributeBuilder, Attribute> builder) Attributes of the Product Variant.setImages
(Function<ImageBuilder, Image> builder) Images of the Product Variant.setPrices
(Function<PriceBuilder, Price> builder) The Embedded Prices of the Product Variant.User-defined unique SKU of the Product Variant.withAssets
(Function<AssetBuilder, AssetBuilder> builder) Media assets of the Product Variant.Attributes of the Product Variant.Set if the Product Variant is tracked by Inventory.withImages
(Function<ImageBuilder, ImageBuilder> builder) Images of the Product Variant.withPrice
(Function<PriceBuilder, Price> builder) Only available when price selection is used.withPrices
(Function<PriceBuilder, PriceBuilder> builder) The Embedded Prices of the Product Variant.withScopedPrice
(Function<ScopedPriceBuilder, ScopedPrice> builder) Only available in response to a Product Projection Search request with Product price selection.
-
Constructor Details
-
ProductVariantBuilder
public ProductVariantBuilder()
-
-
Method Details
-
id
A unique, sequential identifier of the Product Variant within the Product.
- Parameters:
id
- value to be set- Returns:
- Builder
-
sku
User-defined unique SKU of the Product Variant.
- Parameters:
sku
- value to be set- Returns:
- Builder
-
key
User-defined unique identifier of the ProductVariant.
This is different from Product
key
.- Parameters:
key
- value to be set- Returns:
- Builder
-
prices
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
- value to be set- Returns:
- Builder
-
prices
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
- value to be set- Returns:
- Builder
-
plusPrices
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
- value to be set- Returns:
- Builder
-
plusPrices
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:
builder
- function to build the prices value- Returns:
- Builder
-
withPrices
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:
builder
- function to build the prices value- Returns:
- Builder
-
addPrices
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:
builder
- function to build the prices value- Returns:
- Builder
-
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:
builder
- function to build the prices value- Returns:
- Builder
-
attributes
Attributes of the Product Variant.
- Parameters:
attributes
- value to be set- Returns:
- Builder
-
attributes
Attributes of the Product Variant.
- Parameters:
attributes
- value to be set- Returns:
- Builder
-
plusAttributes
Attributes of the Product Variant.
- Parameters:
attributes
- value to be set- Returns:
- Builder
-
plusAttributes
Attributes of the Product Variant.
- Parameters:
builder
- function to build the attributes value- Returns:
- Builder
-
withAttributes
Attributes of the Product Variant.
- Parameters:
builder
- function to build the attributes value- Returns:
- Builder
-
addAttributes
Attributes of the Product Variant.
- Parameters:
builder
- function to build the attributes value- Returns:
- Builder
-
setAttributes
Attributes of the Product Variant.
- Parameters:
builder
- function to build the attributes value- Returns:
- Builder
-
price
Only available when price selection is used. Cannot be used in a Query Predicate.
- Parameters:
builder
- function to build the price value- Returns:
- Builder
-
withPrice
Only available when price selection is used. Cannot be used in a Query Predicate.
- Parameters:
builder
- function to build the price value- Returns:
- Builder
-
price
Only available when price selection is used. Cannot be used in a Query Predicate.
- Parameters:
price
- value to be set- Returns:
- Builder
-
images
Images of the Product Variant.
- Parameters:
images
- value to be set- Returns:
- Builder
-
images
Images of the Product Variant.
- Parameters:
images
- value to be set- Returns:
- Builder
-
plusImages
Images of the Product Variant.
- Parameters:
images
- value to be set- Returns:
- Builder
-
plusImages
Images of the Product Variant.
- Parameters:
builder
- function to build the images value- Returns:
- Builder
-
withImages
Images of the Product Variant.
- Parameters:
builder
- function to build the images value- Returns:
- Builder
-
addImages
Images of the Product Variant.
- Parameters:
builder
- function to build the images value- Returns:
- Builder
-
setImages
Images of the Product Variant.
- Parameters:
builder
- function to build the images value- Returns:
- Builder
-
assets
Media assets of the Product Variant.
- Parameters:
assets
- value to be set- Returns:
- Builder
-
assets
Media assets of the Product Variant.
- Parameters:
assets
- value to be set- Returns:
- Builder
-
plusAssets
Media assets of the Product Variant.
- Parameters:
assets
- value to be set- Returns:
- Builder
-
plusAssets
Media assets of the Product Variant.
- Parameters:
builder
- function to build the assets value- Returns:
- Builder
-
withAssets
Media assets of the Product Variant.
- Parameters:
builder
- function to build the assets value- Returns:
- Builder
-
addAssets
Media assets of the Product Variant.
- Parameters:
builder
- function to build the assets value- Returns:
- Builder
-
setAssets
Media assets of the Product Variant.
- Parameters:
builder
- function to build the assets value- Returns:
- Builder
-
availability
public ProductVariantBuilder availability(Function<ProductVariantAvailabilityBuilder, ProductVariantAvailabilityBuilder> builder) 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:
builder
- function to build the availability value- Returns:
- Builder
-
withAvailability
public ProductVariantBuilder withAvailability(Function<ProductVariantAvailabilityBuilder, ProductVariantAvailability> builder) 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:
builder
- function to build the availability value- Returns:
- Builder
-
availability
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- Returns:
- Builder
-
isMatchingVariant
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- Returns:
- Builder
-
scopedPrice
Only available in response to a Product Projection Search request with Product price selection. Can be used to sort, filter, and facet.
- Parameters:
builder
- function to build the scopedPrice value- Returns:
- Builder
-
withScopedPrice
Only available in response to a Product Projection Search request with Product price selection. Can be used to sort, filter, and facet.
- Parameters:
builder
- function to build the scopedPrice value- Returns:
- Builder
-
scopedPrice
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- Returns:
- Builder
-
scopedPriceDiscounted
Only available in response to a Product Projection Search request with Product price selection.
- Parameters:
scopedPriceDiscounted
- value to be set- Returns:
- Builder
-
getId
A unique, sequential identifier of the Product Variant within the Product.
- Returns:
- id
-
getSku
User-defined unique SKU of the Product Variant.
- Returns:
- sku
-
getKey
User-defined unique identifier of the ProductVariant.
This is different from Product
key
.- Returns:
- 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.
- 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
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
Only available in response to a Product Projection Search request with Product price selection.
- Returns:
- scopedPriceDiscounted
-
build
builds ProductVariant with checking for non-null required values- Specified by:
build
in interfaceBuilder<ProductVariant>
- Returns:
- ProductVariant
-
buildUnchecked
builds ProductVariant without checking for non-null required values- Returns:
- ProductVariant
-
of
factory method for an instance of ProductVariantBuilder- Returns:
- builder
-
of
create builder for ProductVariant instance- Parameters:
template
- instance with prefilled values for the builder- Returns:
- builder
-