Class ProductDiscountDraftBuilder
- All Implemented Interfaces:
Builder<ProductDiscountDraft>
Example to create an instance using the builder pattern
ProductDiscountDraft productDiscountDraft = ProductDiscountDraft.builder()
.name(nameBuilder -> nameBuilder)
.value(valueBuilder -> valueBuilder)
.predicate("{predicate}")
.sortOrder("{sortOrder}")
.isActive(true)
.build()
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
builds ProductDiscountDraft with checking for non-null required valuesbuilds ProductDiscountDraft without checking for non-null required valuesdescription
(LocalizedString description) Description of the ProductDiscount.Description of the ProductDiscount.Description of the ProductDiscount.Set totrue
to activate the ProductDiscount, set tofalse
to deactivate it (even though thepredicate
matches).getKey()
User-defined unique identifier for the ProductDiscount.getName()
Name of the ProductDiscount.Valid ProductDiscount predicate.Decimal value between 0 and 1 (passed as String literal) that defines the order of ProductDiscounts 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.getValue()
Type of Discount and its corresponding value.Set totrue
to activate the ProductDiscount, set tofalse
to deactivate it (even though thepredicate
matches).User-defined unique identifier for the ProductDiscount.name
(LocalizedString name) Name of the ProductDiscount.Name of the ProductDiscount.static ProductDiscountDraftBuilder
of()
factory method for an instance of ProductDiscountDraftBuilderstatic ProductDiscountDraftBuilder
of
(ProductDiscountDraft template) create builder for ProductDiscountDraft instanceValid ProductDiscount predicate.Decimal value between 0 and 1 (passed as String literal) that defines the order of ProductDiscounts to apply in case more than one is applicable and active.validFrom
(ZonedDateTime validFrom) Date and time (UTC) from which the Discount is effective.validUntil
(ZonedDateTime validUntil) Date and time (UTC) until which the Discount is effective.value
(ProductDiscountValueDraft value) Type of Discount and its corresponding value.value
(Function<ProductDiscountValueDraftBuilder, Builder<? extends ProductDiscountValueDraft>> builder) Type of Discount and its corresponding value.Description of the ProductDiscount.Name of the ProductDiscount.
-
Constructor Details
-
ProductDiscountDraftBuilder
public ProductDiscountDraftBuilder()
-
-
Method Details
-
name
public ProductDiscountDraftBuilder name(Function<LocalizedStringBuilder, LocalizedStringBuilder> builder) Name of the ProductDiscount.
- Parameters:
builder
- function to build the name value- Returns:
- Builder
-
withName
public ProductDiscountDraftBuilder withName(Function<LocalizedStringBuilder, LocalizedString> builder) Name of the ProductDiscount.
- Parameters:
builder
- function to build the name value- Returns:
- Builder
-
name
Name of the ProductDiscount.
- Parameters:
name
- value to be set- Returns:
- Builder
-
key
User-defined unique identifier for the ProductDiscount.
- Parameters:
key
- value to be set- Returns:
- Builder
-
description
public ProductDiscountDraftBuilder description(Function<LocalizedStringBuilder, LocalizedStringBuilder> builder) Description of the ProductDiscount.
- Parameters:
builder
- function to build the description value- Returns:
- Builder
-
withDescription
public ProductDiscountDraftBuilder withDescription(Function<LocalizedStringBuilder, LocalizedString> builder) Description of the ProductDiscount.
- Parameters:
builder
- function to build the description value- Returns:
- Builder
-
description
Description of the ProductDiscount.
- Parameters:
description
- value to be set- Returns:
- Builder
-
value
Type of Discount and its corresponding value.
- Parameters:
value
- value to be set- Returns:
- Builder
-
value
public ProductDiscountDraftBuilder value(Function<ProductDiscountValueDraftBuilder, Builder<? extends ProductDiscountValueDraft>> builder) Type of Discount and its corresponding value.
- Parameters:
builder
- function to build the value value- Returns:
- Builder
-
predicate
Valid ProductDiscount predicate.
- Parameters:
predicate
- value to be set- Returns:
- Builder
-
sortOrder
Decimal value between 0 and 1 (passed as String literal) that defines the order of ProductDiscounts to apply in case more than one is applicable and active. A ProductDiscount with a higher
sortOrder
is prioritized. The value must be unique among all ProductDiscounts in the Project.- Parameters:
sortOrder
- value to be set- Returns:
- Builder
-
isActive
Set to
true
to activate the ProductDiscount, set tofalse
to deactivate it (even though thepredicate
matches).- Parameters:
isActive
- value to be set- Returns:
- Builder
-
validFrom
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- Returns:
- Builder
-
validUntil
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- Returns:
- Builder
-
getName
Name of the ProductDiscount.
- Returns:
- name
-
getKey
User-defined unique identifier for the ProductDiscount.
- Returns:
- key
-
getDescription
Description of the ProductDiscount.
- Returns:
- description
-
getValue
Type of Discount and its corresponding value.
- Returns:
- value
-
getPredicate
Valid ProductDiscount predicate.
- Returns:
- predicate
-
getSortOrder
Decimal value between 0 and 1 (passed as String literal) that defines the order of ProductDiscounts to apply in case more than one is applicable and active. A ProductDiscount with a higher
sortOrder
is prioritized. The value must be unique among all ProductDiscounts in the Project.- Returns:
- sortOrder
-
getIsActive
Set to
true
to activate the ProductDiscount, set tofalse
to deactivate it (even though thepredicate
matches).- Returns:
- isActive
-
getValidFrom
Date and time (UTC) from which the Discount is effective. Take Eventual Consistency into account for calculated discount values.
- Returns:
- validFrom
-
getValidUntil
Date and time (UTC) until which the Discount is effective. Take Eventual Consistency into account for calculated undiscounted values.
- Returns:
- validUntil
-
build
builds ProductDiscountDraft with checking for non-null required values- Specified by:
build
in interfaceBuilder<ProductDiscountDraft>
- Returns:
- ProductDiscountDraft
-
buildUnchecked
builds ProductDiscountDraft without checking for non-null required values- Returns:
- ProductDiscountDraft
-
of
factory method for an instance of ProductDiscountDraftBuilder- Returns:
- builder
-
of
create builder for ProductDiscountDraft instance- Parameters:
template
- instance with prefilled values for the builder- Returns:
- builder
-