Interface ProductDiscount
- All Superinterfaces:
BaseResource
,DomainResource<ProductDiscount>
,Identifiable<ProductDiscount>
,ProductDiscountMixin
,Referencable<ProductDiscount>
,ResourceIdentifiable<ProductDiscount>
,Versioned<ProductDiscount>
,WithKey
- All Known Implementing Classes:
ProductDiscountImpl
Example to create an instance using the builder pattern
ProductDiscount productDiscount = ProductDiscount.builder()
.id("{id}")
.version(0.3)
.createdAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
.lastModifiedAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
.name(nameBuilder -> nameBuilder)
.value(valueBuilder -> valueBuilder)
.predicate("{predicate}")
.sortOrder("{sortOrder}")
.isActive(true)
.plusReferences(referencesBuilder -> referencesBuilder)
.build()
-
Method Summary
Modifier and TypeMethodDescriptionstatic ProductDiscountBuilder
builder()
builder factory method for ProductDiscountstatic ProductDiscountBuilder
builder
(ProductDiscount template) create builder for ProductDiscount instancestatic ProductDiscount
deepCopy
(ProductDiscount template) factory method to create a deep copy of ProductDiscount@NotNull ZonedDateTime
Date and time (UTC) the ProductDiscount was initially created.@Valid CreatedBy
Present on resources created after 1 February 2019 except for events not tracked.@Valid LocalizedString
Description of the ProductDiscount.@NotNull String
getId()
Unique identifier of the ProductDiscount.@NotNull Boolean
Iftrue
the Product Discount is applied to Products matching thepredicate
.getKey()
User-defined unique identifier of the ProductDiscount.@NotNull ZonedDateTime
Date and time (UTC) the ProductDiscount was last updated.@Valid LastModifiedBy
Present on resources created after 1 February 2019 except for events not tracked.@NotNull @Valid LocalizedString
getName()
Name of the ProductDiscount.@NotNull String
Valid ProductDiscount predicate.References of all the resources that are addressed in thepredicate
.@NotNull String
Unique decimal value between 0 and 1 (stored as String literal) defining the order of Product Discounts to apply in case more than one is applicable and active.Date and time (UTC) from which the Discount is effective.Date and time (UTC) until which the Discount is effective.@NotNull @Valid ProductDiscountValue
getValue()
Type of Discount and its corresponding value.@NotNull Long
Current version of the ProductDiscount.static ProductDiscount
of()
factory methodstatic ProductDiscount
of
(ProductDiscount template) factory method to create a shallow copy ProductDiscountstatic ReferenceTypeId
void
setCreatedAt
(ZonedDateTime createdAt) Date and time (UTC) the ProductDiscount was initially created.void
setCreatedBy
(CreatedBy createdBy) Present on resources created after 1 February 2019 except for events not tracked.void
setDescription
(LocalizedString description) Description of the ProductDiscount.void
Unique identifier of the ProductDiscount.void
setIsActive
(Boolean isActive) Iftrue
the Product Discount is applied to Products matching thepredicate
.void
User-defined unique identifier of the ProductDiscount.void
setLastModifiedAt
(ZonedDateTime lastModifiedAt) Date and time (UTC) the ProductDiscount was last updated.void
setLastModifiedBy
(LastModifiedBy lastModifiedBy) Present on resources created after 1 February 2019 except for events not tracked.void
setName
(LocalizedString name) Name of the ProductDiscount.void
setPredicate
(String predicate) Valid ProductDiscount predicate.void
setReferences
(Reference... references) References of all the resources that are addressed in thepredicate
.void
setReferences
(List<Reference> references) References of all the resources that are addressed in thepredicate
.void
setSortOrder
(String sortOrder) Unique decimal value between 0 and 1 (stored as String literal) defining the order of Product Discounts to apply in case more than one is applicable and active.void
setValidFrom
(ZonedDateTime validFrom) Date and time (UTC) from which the Discount is effective.void
setValidUntil
(ZonedDateTime validUntil) Date and time (UTC) until which the Discount is effective.void
setValue
(ProductDiscountValue value) Type of Discount and its corresponding value.void
setVersion
(Long version) Current version of the ProductDiscount.static com.fasterxml.jackson.core.type.TypeReference<ProductDiscount>
gives a TypeReference for usage with Jackson DataBinddefault <T> T
withProductDiscount
(Function<ProductDiscount, 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_discount.ProductDiscountMixin
toReference, toResourceIdentifier
-
Method Details
-
getId
Unique identifier of the ProductDiscount.
- Specified by:
getId
in interfaceBaseResource
- Specified by:
getId
in interfaceDomainResource<ProductDiscount>
- Specified by:
getId
in interfaceIdentifiable<ProductDiscount>
- Specified by:
getId
in interfaceVersioned<ProductDiscount>
- Returns:
- id
-
getVersion
Current version of the ProductDiscount.
- Specified by:
getVersion
in interfaceBaseResource
- Specified by:
getVersion
in interfaceDomainResource<ProductDiscount>
- Specified by:
getVersion
in interfaceVersioned<ProductDiscount>
- Returns:
- version
-
getCreatedAt
Date and time (UTC) the ProductDiscount was initially created.
- Specified by:
getCreatedAt
in interfaceBaseResource
- Returns:
- createdAt
-
getLastModifiedAt
Date and time (UTC) the ProductDiscount was last updated.
- Specified by:
getLastModifiedAt
in interfaceBaseResource
- Returns:
- lastModifiedAt
-
getLastModifiedBy
Present on resources created after 1 February 2019 except for events not tracked.
- Returns:
- lastModifiedBy
-
getCreatedBy
Present on resources created after 1 February 2019 except for events not tracked.
- Returns:
- createdBy
-
getName
Name of the ProductDiscount.
- Returns:
- name
-
getKey
String getKey()User-defined unique identifier of the ProductDiscount.
-
getDescription
Description of the ProductDiscount.
- Returns:
- description
-
getValue
Type of Discount and its corresponding value.
- Returns:
- value
-
getPredicate
Valid ProductDiscount predicate.
- Returns:
- predicate
-
getSortOrder
Unique decimal value between 0 and 1 (stored as String literal) defining the order of Product Discounts to apply in case more than one is applicable and active. A Product Discount with a higher value is prioritized.
- Returns:
- sortOrder
-
getIsActive
If
true
the Product Discount is applied to Products matching thepredicate
.- Returns:
- isActive
-
getReferences
References of all the resources that are addressed in the
predicate
.- Returns:
- references
-
getValidFrom
ZonedDateTime getValidFrom()Date and time (UTC) from which the Discount is effective. Take Eventual Consistency into account for calculated discount values.
- Returns:
- validFrom
-
getValidUntil
ZonedDateTime getValidUntil()Date and time (UTC) until which the Discount is effective. Take Eventual Consistency into account for calculated undiscounted values.
- Returns:
- validUntil
-
setId
Unique identifier of the ProductDiscount.
- Specified by:
setId
in interfaceBaseResource
- Parameters:
id
- value to be set
-
setVersion
Current version of the ProductDiscount.
- Specified by:
setVersion
in interfaceBaseResource
- Parameters:
version
- value to be set
-
setCreatedAt
Date and time (UTC) the ProductDiscount was initially created.
- Specified by:
setCreatedAt
in interfaceBaseResource
- Parameters:
createdAt
- value to be set
-
setLastModifiedAt
Date and time (UTC) the ProductDiscount was last updated.
- Specified by:
setLastModifiedAt
in interfaceBaseResource
- Parameters:
lastModifiedAt
- value to be set
-
setLastModifiedBy
Present on resources created after 1 February 2019 except for events not tracked.
- Parameters:
lastModifiedBy
- value to be set
-
setCreatedBy
Present on resources created after 1 February 2019 except for events not tracked.
- Parameters:
createdBy
- value to be set
-
setName
Name of the ProductDiscount.
- Parameters:
name
- value to be set
-
setKey
User-defined unique identifier of the ProductDiscount.
- Parameters:
key
- value to be set
-
setDescription
Description of the ProductDiscount.
- Parameters:
description
- value to be set
-
setValue
Type of Discount and its corresponding value.
- Parameters:
value
- value to be set
-
setPredicate
Valid ProductDiscount predicate.
- Parameters:
predicate
- value to be set
-
setSortOrder
Unique decimal value between 0 and 1 (stored as String literal) defining the order of Product Discounts to apply in case more than one is applicable and active. A Product Discount with a higher value is prioritized.
- Parameters:
sortOrder
- value to be set
-
setIsActive
If
true
the Product Discount is applied to Products matching thepredicate
.- Parameters:
isActive
- value to be set
-
setReferences
References of all the resources that are addressed in the
predicate
.- Parameters:
references
- values to be set
-
setReferences
References of all the resources that are addressed in the
predicate
.- Parameters:
references
- values to be set
-
setValidFrom
Date and time (UTC) from which the Discount is effective. Take Eventual Consistency into account for calculated discount values.
- Parameters:
validFrom
- value to be set
-
setValidUntil
Date and time (UTC) until which the Discount is effective. Take Eventual Consistency into account for calculated undiscounted values.
- Parameters:
validUntil
- value to be set
-
of
factory method- Returns:
- instance of ProductDiscount
-
of
factory method to create a shallow copy ProductDiscount- Parameters:
template
- instance to be copied- Returns:
- copy instance
-
deepCopy
factory method to create a deep copy of ProductDiscount- Parameters:
template
- instance to be copied- Returns:
- copy instance
-
builder
builder factory method for ProductDiscount- Returns:
- builder
-
builder
create builder for ProductDiscount instance- Parameters:
template
- instance with prefilled values for the builder- Returns:
- builder
-
withProductDiscount
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
-