Interface Product
- All Superinterfaces:
BaseResource
,DomainResource<Product>
,Identifiable<Product>
,ProductMixin
,Referencable<Product>
,ResourceIdentifiable<Product>
,Versioned<Product>
,WithKey
An abstract sellable good with a set of Attributes defined by a Product Type. Products themselves are not sellable. Instead, they act as a parent structure for Product Variants. Each Product must have at least one Product Variant, which is called the Master Variant. A single Product representation contains the current and the staged representation of its product data.
Example to create an instance using the builder pattern
Product product = Product.builder()
.id("{id}")
.version(0.3)
.createdAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
.lastModifiedAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
.productType(productTypeBuilder -> productTypeBuilder)
.masterData(masterDataBuilder -> masterDataBuilder)
.build()
-
Method Summary
Modifier and TypeMethodDescriptionstatic ProductBuilder
builder()
builder factory method for Productstatic ProductBuilder
create builder for Product instancestatic Product
factory method to create a deep copy of Product@NotNull ZonedDateTime
Date and time (UTC) the Product was initially created.@Valid CreatedBy
IDs and references that created the Product.@NotNull String
getId()
Unique identifier of the Product.getKey()
User-defined unique identifier of the Product.@NotNull ZonedDateTime
Date and time (UTC) the Product was last updated.@Valid LastModifiedBy
IDs and references that last modified the Product.@NotNull @Valid ProductCatalogData
Contains the current and the staged representation of the product information.Type of Price to be used when looking up a price for the Product.@NotNull @Valid ProductTypeReference
The Product Type defining the Attributes of the Product.@Valid ReviewRatingStatistics
Review statistics of the Product.@Valid StateReference
getState()
State of the Product.@Valid TaxCategoryReference
The TaxCategory of the Product.@NotNull Long
Current version of the Product.@Valid List<WarningObject>
Warnings about processing of a request.static Product
of()
factory methodstatic Product
factory method to create a shallow copy Productstatic ReferenceTypeId
void
setCreatedAt
(ZonedDateTime createdAt) Date and time (UTC) the Product was initially created.void
setCreatedBy
(CreatedBy createdBy) IDs and references that created the Product.void
Unique identifier of the Product.void
User-defined unique identifier of the Product.void
setLastModifiedAt
(ZonedDateTime lastModifiedAt) Date and time (UTC) the Product was last updated.void
setLastModifiedBy
(LastModifiedBy lastModifiedBy) IDs and references that last modified the Product.void
setMasterData
(ProductCatalogData masterData) Contains the current and the staged representation of the product information.void
setPriceMode
(ProductPriceModeEnum priceMode) Type of Price to be used when looking up a price for the Product.void
setProductType
(ProductTypeReference productType) The Product Type defining the Attributes of the Product.void
setReviewRatingStatistics
(ReviewRatingStatistics reviewRatingStatistics) Review statistics of the Product.void
setState
(StateReference state) State of the Product.void
setTaxCategory
(TaxCategoryReference taxCategory) The TaxCategory of the Product.void
setVersion
(Long version) Current version of the Product.void
setWarnings
(WarningObject... warnings) Warnings about processing of a request.void
setWarnings
(List<WarningObject> warnings) Warnings about processing of a request.static com.fasterxml.jackson.core.type.TypeReference<Product>
gives a TypeReference for usage with Jackson DataBinddefault <T> T
withProduct
(Function<Product, T> helper) accessor map functionMethods inherited from interface com.commercetools.api.models.common.BaseResource
withBaseResource
Methods inherited from interface com.commercetools.api.models.DomainResource
get
Methods inherited from interface com.commercetools.api.models.product.ProductMixin
toReference, toResourceIdentifier
-
Method Details
-
getId
Unique identifier of the Product.
- Specified by:
getId
in interfaceBaseResource
- Specified by:
getId
in interfaceDomainResource<Product>
- Specified by:
getId
in interfaceIdentifiable<Product>
- Specified by:
getId
in interfaceVersioned<Product>
- Returns:
- id
-
getVersion
Current version of the Product.
- Specified by:
getVersion
in interfaceBaseResource
- Specified by:
getVersion
in interfaceDomainResource<Product>
- Specified by:
getVersion
in interfaceVersioned<Product>
- Returns:
- version
-
getCreatedAt
Date and time (UTC) the Product was initially created.
- Specified by:
getCreatedAt
in interfaceBaseResource
- Returns:
- createdAt
-
getLastModifiedAt
Date and time (UTC) the Product was last updated.
- Specified by:
getLastModifiedAt
in interfaceBaseResource
- Returns:
- lastModifiedAt
-
getLastModifiedBy
IDs and references that last modified the Product.
- Returns:
- lastModifiedBy
-
getCreatedBy
IDs and references that created the Product.
- Returns:
- createdBy
-
getKey
String getKey()User-defined unique identifier of the Product.
This is different from the
key
of a ProductVariant. -
getProductType
The Product Type defining the Attributes of the Product. Cannot be changed.
- Returns:
- productType
-
getMasterData
Contains the current and the staged representation of the product information.
- Returns:
- masterData
-
getTaxCategory
The TaxCategory of the Product.
- Returns:
- taxCategory
-
getState
State of the Product.
- Returns:
- state
-
getReviewRatingStatistics
Review statistics of the Product.
- Returns:
- reviewRatingStatistics
-
getPriceMode
ProductPriceModeEnum getPriceMode()Type of Price to be used when looking up a price for the Product.
- Returns:
- priceMode
-
getWarnings
Warnings about processing of a request. Appears in response to requests with response status code
202 Accepted
.- Returns:
- warnings
-
setId
Unique identifier of the Product.
- Specified by:
setId
in interfaceBaseResource
- Parameters:
id
- value to be set
-
setVersion
Current version of the Product.
- Specified by:
setVersion
in interfaceBaseResource
- Parameters:
version
- value to be set
-
setCreatedAt
Date and time (UTC) the Product was initially created.
- Specified by:
setCreatedAt
in interfaceBaseResource
- Parameters:
createdAt
- value to be set
-
setLastModifiedAt
Date and time (UTC) the Product was last updated.
- Specified by:
setLastModifiedAt
in interfaceBaseResource
- Parameters:
lastModifiedAt
- value to be set
-
setLastModifiedBy
IDs and references that last modified the Product.
- Parameters:
lastModifiedBy
- value to be set
-
setCreatedBy
IDs and references that created the Product.
- Parameters:
createdBy
- value to be set
-
setKey
User-defined unique identifier of the Product.
This is different from the
key
of a ProductVariant.- Parameters:
key
- value to be set
-
setProductType
The Product Type defining the Attributes of the Product. Cannot be changed.
- Parameters:
productType
- value to be set
-
setMasterData
Contains the current and the staged representation of the product information.
- Parameters:
masterData
- value to be set
-
setTaxCategory
The TaxCategory of the Product.
- Parameters:
taxCategory
- value to be set
-
setState
State of the Product.
- Parameters:
state
- value to be set
-
setReviewRatingStatistics
Review statistics of the Product.
- Parameters:
reviewRatingStatistics
- value to be set
-
setPriceMode
Type of Price to be used when looking up a price for the Product.
- Parameters:
priceMode
- value to be set
-
setWarnings
Warnings about processing of a request. Appears in response to requests with response status code
202 Accepted
.- Parameters:
warnings
- values to be set
-
setWarnings
Warnings about processing of a request. Appears in response to requests with response status code
202 Accepted
.- Parameters:
warnings
- values to be set
-
of
factory method- Returns:
- instance of Product
-
of
factory method to create a shallow copy Product- Parameters:
template
- instance to be copied- Returns:
- copy instance
-
deepCopy
factory method to create a deep copy of Product- Parameters:
template
- instance to be copied- Returns:
- copy instance
-
builder
builder factory method for Product- Returns:
- builder
-
builder
create builder for Product instance- Parameters:
template
- instance with prefilled values for the builder- Returns:
- builder
-
withProduct
accessor map function- Type Parameters:
T
- mapped type- Parameters:
helper
- function to map the object- Returns:
- mapped value
-
referenceTypeId
-
typeReference
gives a TypeReference for usage with Jackson DataBind- Returns:
- TypeReference
-