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 ProductBuilderbuilder()builder factory method for Productstatic ProductBuildercreate builder for Product instancecopyDeep()static Productfactory method to create a deep copy of Product@NotNull ZonedDateTimeDate and time (UTC) the Product was initially created.@Valid CreatedByIDs and references that created the Product.@NotNull StringgetId()Unique identifier of the Product.getKey()User-defined unique identifier of the Product.@NotNull ZonedDateTimeDate and time (UTC) the Product was last updated.@Valid LastModifiedByIDs and references that last modified the Product.@NotNull @Valid ProductCatalogDataContains 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 ProductTypeReferenceThe Product Type defining the Attributes of the Product.@Valid ReviewRatingStatisticsReview statistics of the Product.@Valid StateReferencegetState()State of the Product.@Valid TaxCategoryReferenceThe TaxCategory of the Product.@NotNull LongCurrent version of the Product.@Valid List<WarningObject>Warnings about processing of a request.static Productof()factory methodstatic Productfactory method to create a shallow copy Productstatic ReferenceTypeIdvoidsetCreatedAt(ZonedDateTime createdAt) Date and time (UTC) the Product was initially created.voidsetCreatedBy(CreatedBy createdBy) IDs and references that created the Product.voidUnique identifier of the Product.voidUser-defined unique identifier of the Product.voidsetLastModifiedAt(ZonedDateTime lastModifiedAt) Date and time (UTC) the Product was last updated.voidsetLastModifiedBy(LastModifiedBy lastModifiedBy) IDs and references that last modified the Product.voidsetMasterData(ProductCatalogData masterData) Contains the current and the staged representation of the product information.voidsetPriceMode(ProductPriceModeEnum priceMode) Type of Price to be used when looking up a price for the Product.voidsetProductType(ProductTypeReference productType) The Product Type defining the Attributes of the Product.voidsetReviewRatingStatistics(ReviewRatingStatistics reviewRatingStatistics) Review statistics of the Product.voidsetState(StateReference state) State of the Product.voidsetTaxCategory(TaxCategoryReference taxCategory) The TaxCategory of the Product.voidsetVersion(Long version) Current version of the Product.voidsetWarnings(WarningObject... warnings) Warnings about processing of a request.voidsetWarnings(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> TwithProduct(Function<Product, T> helper) accessor map functionMethods inherited from interface com.commercetools.api.models.common.BaseResource
withBaseResourceMethods inherited from interface com.commercetools.api.models.DomainResource
getMethods inherited from interface com.commercetools.api.models.product.ProductMixin
toReference, toResourceIdentifier
-
Method Details
-
getId
Unique identifier of the Product.
- Specified by:
getIdin interfaceBaseResource- Specified by:
getIdin interfaceDomainResource<Product>- Specified by:
getIdin interfaceIdentifiable<Product>- Specified by:
getIdin interfaceVersioned<Product>- Returns:
- id
-
getVersion
Current version of the Product.
- Specified by:
getVersionin interfaceBaseResource- Specified by:
getVersionin interfaceDomainResource<Product>- Specified by:
getVersionin interfaceVersioned<Product>- Returns:
- version
-
getCreatedAt
Date and time (UTC) the Product was initially created.
- Specified by:
getCreatedAtin interfaceBaseResource- Returns:
- createdAt
-
getLastModifiedAt
Date and time (UTC) the Product was last updated.
- Specified by:
getLastModifiedAtin 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
keyof 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:
setIdin interfaceBaseResource- Parameters:
id- value to be set
-
setVersion
Current version of the Product.
- Specified by:
setVersionin interfaceBaseResource- Parameters:
version- value to be set
-
setCreatedAt
Date and time (UTC) the Product was initially created.
- Specified by:
setCreatedAtin interfaceBaseResource- Parameters:
createdAt- value to be set
-
setLastModifiedAt
Date and time (UTC) the Product was last updated.
- Specified by:
setLastModifiedAtin 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
keyof 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
-
copyDeep
Product copyDeep()- Specified by:
copyDeepin interfaceBaseResource
-
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
-