Class CartDiscountPatternTargetBuilder
- All Implemented Interfaces:
Builder<CartDiscountPatternTarget>
Example to create an instance using the builder pattern
CartDiscountPatternTarget cartDiscountPatternTarget = CartDiscountPatternTarget.builder()
.plusTriggerPattern(triggerPatternBuilder -> triggerPatternBuilder)
.plusTargetPattern(targetPatternBuilder -> targetPatternBuilder)
.selectionMode(SelectionMode.CHEAPEST)
.build()
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
builds CartDiscountPatternTarget with checking for non-null required valuesbuilds CartDiscountPatternTarget without checking for non-null required valuesMaximum number of times the Discount can apply on a Cart.Determines which of the matching units of (Custom) Line Items are discounted.Defines the set of units of (Custom) Line Items in a Cart on which the Discount is applied.Defines the set of units of (Custom) Line Items in a Cart that trigger a discount application.maxOccurrence
(Integer maxOccurrence) Maximum number of times the Discount can apply on a Cart.of()
factory method for an instance of CartDiscountPatternTargetBuilderof
(CartDiscountPatternTarget template) create builder for CartDiscountPatternTarget instanceplusTargetPattern
(PatternComponent... targetPattern) Defines the set of units of (Custom) Line Items in a Cart on which the Discount is applied.plusTargetPattern
(Function<PatternComponentBuilder, Builder<? extends PatternComponent>> builder) Defines the set of units of (Custom) Line Items in a Cart on which the Discount is applied.plusTriggerPattern
(PatternComponent... triggerPattern) Defines the set of units of (Custom) Line Items in a Cart that trigger a discount application.plusTriggerPattern
(Function<PatternComponentBuilder, Builder<? extends PatternComponent>> builder) Defines the set of units of (Custom) Line Items in a Cart that trigger a discount application.selectionMode
(SelectionMode selectionMode) Determines which of the matching units of (Custom) Line Items are discounted.targetPattern
(PatternComponent... targetPattern) Defines the set of units of (Custom) Line Items in a Cart on which the Discount is applied.targetPattern
(List<PatternComponent> targetPattern) Defines the set of units of (Custom) Line Items in a Cart on which the Discount is applied.triggerPattern
(PatternComponent... triggerPattern) Defines the set of units of (Custom) Line Items in a Cart that trigger a discount application.triggerPattern
(List<PatternComponent> triggerPattern) Defines the set of units of (Custom) Line Items in a Cart that trigger a discount application.withTargetPattern
(Function<PatternComponentBuilder, Builder<? extends PatternComponent>> builder) Defines the set of units of (Custom) Line Items in a Cart on which the Discount is applied.withTriggerPattern
(Function<PatternComponentBuilder, Builder<? extends PatternComponent>> builder) Defines the set of units of (Custom) Line Items in a Cart that trigger a discount application.
-
Constructor Details
-
CartDiscountPatternTargetBuilder
public CartDiscountPatternTargetBuilder()
-
-
Method Details
-
triggerPattern
Defines the set of units of (Custom) Line Items in a Cart that trigger a discount application.
Based on the availability of matching units, the
triggerPattern
can match multiple times, limiting the number of maximum times the discount will be applied. To further limit the discount application, set themaxOccurrence
.If empty, the Discount will apply indefinitely.
- Parameters:
triggerPattern
- value to be set- Returns:
- Builder
-
triggerPattern
Defines the set of units of (Custom) Line Items in a Cart that trigger a discount application.
Based on the availability of matching units, the
triggerPattern
can match multiple times, limiting the number of maximum times the discount will be applied. To further limit the discount application, set themaxOccurrence
.If empty, the Discount will apply indefinitely.
- Parameters:
triggerPattern
- value to be set- Returns:
- Builder
-
plusTriggerPattern
Defines the set of units of (Custom) Line Items in a Cart that trigger a discount application.
Based on the availability of matching units, the
triggerPattern
can match multiple times, limiting the number of maximum times the discount will be applied. To further limit the discount application, set themaxOccurrence
.If empty, the Discount will apply indefinitely.
- Parameters:
triggerPattern
- value to be set- Returns:
- Builder
-
plusTriggerPattern
public CartDiscountPatternTargetBuilder plusTriggerPattern(Function<PatternComponentBuilder, Builder<? extends PatternComponent>> builder) Defines the set of units of (Custom) Line Items in a Cart that trigger a discount application.
Based on the availability of matching units, the
triggerPattern
can match multiple times, limiting the number of maximum times the discount will be applied. To further limit the discount application, set themaxOccurrence
.If empty, the Discount will apply indefinitely.
- Parameters:
builder
- function to build the triggerPattern value- Returns:
- Builder
-
withTriggerPattern
public CartDiscountPatternTargetBuilder withTriggerPattern(Function<PatternComponentBuilder, Builder<? extends PatternComponent>> builder) Defines the set of units of (Custom) Line Items in a Cart that trigger a discount application.
Based on the availability of matching units, the
triggerPattern
can match multiple times, limiting the number of maximum times the discount will be applied. To further limit the discount application, set themaxOccurrence
.If empty, the Discount will apply indefinitely.
- Parameters:
builder
- function to build the triggerPattern value- Returns:
- Builder
-
targetPattern
Defines the set of units of (Custom) Line Items in a Cart on which the Discount is applied.
Based on the availability of matching units and the limits from the
triggerPattern
ormaxOccurence
, thetargetPattern
can match multiple times.This array cannot be empty.
- Parameters:
targetPattern
- value to be set- Returns:
- Builder
-
targetPattern
Defines the set of units of (Custom) Line Items in a Cart on which the Discount is applied.
Based on the availability of matching units and the limits from the
triggerPattern
ormaxOccurence
, thetargetPattern
can match multiple times.This array cannot be empty.
- Parameters:
targetPattern
- value to be set- Returns:
- Builder
-
plusTargetPattern
Defines the set of units of (Custom) Line Items in a Cart on which the Discount is applied.
Based on the availability of matching units and the limits from the
triggerPattern
ormaxOccurence
, thetargetPattern
can match multiple times.This array cannot be empty.
- Parameters:
targetPattern
- value to be set- Returns:
- Builder
-
plusTargetPattern
public CartDiscountPatternTargetBuilder plusTargetPattern(Function<PatternComponentBuilder, Builder<? extends PatternComponent>> builder) Defines the set of units of (Custom) Line Items in a Cart on which the Discount is applied.
Based on the availability of matching units and the limits from the
triggerPattern
ormaxOccurence
, thetargetPattern
can match multiple times.This array cannot be empty.
- Parameters:
builder
- function to build the targetPattern value- Returns:
- Builder
-
withTargetPattern
public CartDiscountPatternTargetBuilder withTargetPattern(Function<PatternComponentBuilder, Builder<? extends PatternComponent>> builder) Defines the set of units of (Custom) Line Items in a Cart on which the Discount is applied.
Based on the availability of matching units and the limits from the
triggerPattern
ormaxOccurence
, thetargetPattern
can match multiple times.This array cannot be empty.
- Parameters:
builder
- function to build the targetPattern value- Returns:
- Builder
-
maxOccurrence
Maximum number of times the Discount can apply on a Cart.
If empty or not set, the Discount will apply indefinitely.
- Parameters:
maxOccurrence
- value to be set- Returns:
- Builder
-
selectionMode
Determines which of the matching units of (Custom) Line Items are discounted.
- Parameters:
selectionMode
- value to be set- Returns:
- Builder
-
getTriggerPattern
Defines the set of units of (Custom) Line Items in a Cart that trigger a discount application.
Based on the availability of matching units, the
triggerPattern
can match multiple times, limiting the number of maximum times the discount will be applied. To further limit the discount application, set themaxOccurrence
.If empty, the Discount will apply indefinitely.
- Returns:
- triggerPattern
-
getTargetPattern
Defines the set of units of (Custom) Line Items in a Cart on which the Discount is applied.
Based on the availability of matching units and the limits from the
triggerPattern
ormaxOccurence
, thetargetPattern
can match multiple times.This array cannot be empty.
- Returns:
- targetPattern
-
getMaxOccurrence
Maximum number of times the Discount can apply on a Cart.
If empty or not set, the Discount will apply indefinitely.
- Returns:
- maxOccurrence
-
getSelectionMode
Determines which of the matching units of (Custom) Line Items are discounted.
- Returns:
- selectionMode
-
build
builds CartDiscountPatternTarget with checking for non-null required values- Specified by:
build
in interfaceBuilder<CartDiscountPatternTarget>
- Returns:
- CartDiscountPatternTarget
-
buildUnchecked
builds CartDiscountPatternTarget without checking for non-null required values- Returns:
- CartDiscountPatternTarget
-
of
factory method for an instance of CartDiscountPatternTargetBuilder- Returns:
- builder
-
of
create builder for CartDiscountPatternTarget instance- Parameters:
template
- instance with prefilled values for the builder- Returns:
- builder
-