Class CartDiscountPatternTargetBuilder

java.lang.Object
com.commercetools.api.models.cart_discount.CartDiscountPatternTargetBuilder
All Implemented Interfaces:
Builder<CartDiscountPatternTarget>

public class CartDiscountPatternTargetBuilder extends Object implements Builder<CartDiscountPatternTarget>
CartDiscountPatternTargetBuilder
Example to create an instance using the builder pattern

     CartDiscountPatternTarget cartDiscountPatternTarget = CartDiscountPatternTarget.builder()
             .plusTriggerPattern(triggerPatternBuilder -> triggerPatternBuilder)
             .plusTargetPattern(targetPatternBuilder -> targetPatternBuilder)
             .selectionMode(SelectionMode.CHEAPEST)
             .build()
 
  • Constructor Details

    • CartDiscountPatternTargetBuilder

      public CartDiscountPatternTargetBuilder()
  • Method Details

    • triggerPattern

      public CartDiscountPatternTargetBuilder triggerPattern(PatternComponent... 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 the maxOccurrence.

      If empty, the Discount will apply indefinitely.

      Parameters:
      triggerPattern - value to be set
      Returns:
      Builder
    • triggerPattern

      public CartDiscountPatternTargetBuilder triggerPattern(List<PatternComponent> 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 the maxOccurrence.

      If empty, the Discount will apply indefinitely.

      Parameters:
      triggerPattern - value to be set
      Returns:
      Builder
    • plusTriggerPattern

      public CartDiscountPatternTargetBuilder plusTriggerPattern(PatternComponent... 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 the maxOccurrence.

      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 the maxOccurrence.

      If empty, the Discount will apply indefinitely.

      Parameters:
      builder - function to build the triggerPattern value
      Returns:
      Builder
    • withTriggerPattern

      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 the maxOccurrence.

      If empty, the Discount will apply indefinitely.

      Parameters:
      builder - function to build the triggerPattern value
      Returns:
      Builder
    • targetPattern

      public CartDiscountPatternTargetBuilder targetPattern(PatternComponent... 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 or maxOccurence, the targetPattern can match multiple times.

      This array cannot be empty.

      Parameters:
      targetPattern - value to be set
      Returns:
      Builder
    • targetPattern

      public CartDiscountPatternTargetBuilder targetPattern(List<PatternComponent> 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 or maxOccurence, the targetPattern can match multiple times.

      This array cannot be empty.

      Parameters:
      targetPattern - value to be set
      Returns:
      Builder
    • plusTargetPattern

      public CartDiscountPatternTargetBuilder plusTargetPattern(PatternComponent... 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 or maxOccurence, the targetPattern 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 or maxOccurence, the targetPattern can match multiple times.

      This array cannot be empty.

      Parameters:
      builder - function to build the targetPattern value
      Returns:
      Builder
    • withTargetPattern

      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 or maxOccurence, the targetPattern can match multiple times.

      This array cannot be empty.

      Parameters:
      builder - function to build the targetPattern value
      Returns:
      Builder
    • maxOccurrence

      public CartDiscountPatternTargetBuilder maxOccurrence(@Nullable Integer 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

      public CartDiscountPatternTargetBuilder selectionMode(SelectionMode selectionMode)

      Determines which of the matching units of (Custom) Line Items are discounted.

      Parameters:
      selectionMode - value to be set
      Returns:
      Builder
    • getTriggerPattern

      public List<PatternComponent> 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 the maxOccurrence.

      If empty, the Discount will apply indefinitely.

      Returns:
      triggerPattern
    • getTargetPattern

      public List<PatternComponent> 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 or maxOccurence, the targetPattern can match multiple times.

      This array cannot be empty.

      Returns:
      targetPattern
    • getMaxOccurrence

      @Nullable public Integer 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

      public SelectionMode getSelectionMode()

      Determines which of the matching units of (Custom) Line Items are discounted.

      Returns:
      selectionMode
    • build

      public CartDiscountPatternTarget build()
      builds CartDiscountPatternTarget with checking for non-null required values
      Specified by:
      build in interface Builder<CartDiscountPatternTarget>
      Returns:
      CartDiscountPatternTarget
    • buildUnchecked

      public 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