Class CartDiscountPatternTargetBuilder
- All Implemented Interfaces:
Builder<CartDiscountPatternTarget>
Example to create an instance using the builder pattern
CartDiscountPatternTarget cartDiscountPatternTarget = CartDiscountPatternTarget.builder()
.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.Units of (Custom) Line Items on which the Discount is applied.Units of a (Custom) Line Item 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) Units of (Custom) Line Items on which the Discount is applied.plusTargetPattern
(Function<PatternComponentBuilder, Builder<? extends PatternComponent>> builder) Units of (Custom) Line Items on which the Discount is applied.plusTriggerPattern
(PatternComponent... triggerPattern) Units of a (Custom) Line Item that trigger a discount application.plusTriggerPattern
(Function<PatternComponentBuilder, Builder<? extends PatternComponent>> builder) Units of a (Custom) Line Item that trigger a discount application.selectionMode
(SelectionMode selectionMode) Determines which of the matching units of (Custom) Line Items are discounted.targetPattern
(PatternComponent... targetPattern) Units of (Custom) Line Items on which the Discount is applied.targetPattern
(List<PatternComponent> targetPattern) Units of (Custom) Line Items on which the Discount is applied.triggerPattern
(PatternComponent... triggerPattern) Units of a (Custom) Line Item that trigger a discount application.triggerPattern
(List<PatternComponent> triggerPattern) Units of a (Custom) Line Item that trigger a discount application.withTargetPattern
(Function<PatternComponentBuilder, Builder<? extends PatternComponent>> builder) Units of (Custom) Line Items on which the Discount is applied.withTriggerPattern
(Function<PatternComponentBuilder, Builder<? extends PatternComponent>> builder) Units of a (Custom) Line Item that trigger a discount application.
-
Constructor Details
-
CartDiscountPatternTargetBuilder
public CartDiscountPatternTargetBuilder()
-
-
Method Details
-
triggerPattern
public CartDiscountPatternTargetBuilder triggerPattern(@Nullable PatternComponent... triggerPattern) Units of a (Custom) Line Item that trigger a discount application.
Based on the availability of matching units, the
triggerPattern
can match multiple times, effecting the number of times the discount will be applied. To further limit the discount application, set themaxOccurrence
.If empty or not set, the Discount will apply indefinitely.
- Parameters:
triggerPattern
- value to be set- Returns:
- Builder
-
triggerPattern
public CartDiscountPatternTargetBuilder triggerPattern(@Nullable List<PatternComponent> triggerPattern) Units of a (Custom) Line Item that trigger a discount application.
Based on the availability of matching units, the
triggerPattern
can match multiple times, effecting the number of times the discount will be applied. To further limit the discount application, set themaxOccurrence
.If empty or not set, the Discount will apply indefinitely.
- Parameters:
triggerPattern
- value to be set- Returns:
- Builder
-
plusTriggerPattern
public CartDiscountPatternTargetBuilder plusTriggerPattern(@Nullable PatternComponent... triggerPattern) Units of a (Custom) Line Item that trigger a discount application.
Based on the availability of matching units, the
triggerPattern
can match multiple times, effecting the number of times the discount will be applied. To further limit the discount application, set themaxOccurrence
.If empty or not set, the Discount will apply indefinitely.
- Parameters:
triggerPattern
- value to be set- Returns:
- Builder
-
plusTriggerPattern
public CartDiscountPatternTargetBuilder plusTriggerPattern(Function<PatternComponentBuilder, Builder<? extends PatternComponent>> builder) Units of a (Custom) Line Item that trigger a discount application.
Based on the availability of matching units, the
triggerPattern
can match multiple times, effecting the number of times the discount will be applied. To further limit the discount application, set themaxOccurrence
.If empty or not set, 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) Units of a (Custom) Line Item that trigger a discount application.
Based on the availability of matching units, the
triggerPattern
can match multiple times, effecting the number of times the discount will be applied. To further limit the discount application, set themaxOccurrence
.If empty or not set, the Discount will apply indefinitely.
- Parameters:
builder
- function to build the triggerPattern value- Returns:
- Builder
-
targetPattern
Units of (Custom) Line Items 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.- Parameters:
targetPattern
- value to be set- Returns:
- Builder
-
targetPattern
Units of (Custom) Line Items 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.- Parameters:
targetPattern
- value to be set- Returns:
- Builder
-
plusTargetPattern
Units of (Custom) Line Items 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.- Parameters:
targetPattern
- value to be set- Returns:
- Builder
-
plusTargetPattern
public CartDiscountPatternTargetBuilder plusTargetPattern(Function<PatternComponentBuilder, Builder<? extends PatternComponent>> builder) Units of (Custom) Line Items 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.- Parameters:
builder
- function to build the targetPattern value- Returns:
- Builder
-
withTargetPattern
public CartDiscountPatternTargetBuilder withTargetPattern(Function<PatternComponentBuilder, Builder<? extends PatternComponent>> builder) Units of (Custom) Line Items 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.- 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
Units of a (Custom) Line Item that trigger a discount application.
Based on the availability of matching units, the
triggerPattern
can match multiple times, effecting the number of times the discount will be applied. To further limit the discount application, set themaxOccurrence
.If empty or not set, the Discount will apply indefinitely.
- Returns:
- triggerPattern
-
getTargetPattern
Units of (Custom) Line Items 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.- 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
-