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()
             .plusTargetPattern(targetPatternBuilder -> targetPatternBuilder)
             .selectionMode(SelectionMode.CHEAPEST)
             .build()
 
  • 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 the maxOccurrence.

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

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

      If empty or not set, the Discount will apply indefinitely.

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

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

      If empty or not set, the Discount will apply indefinitely.

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

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

      If empty or not set, the Discount will apply indefinitely.

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

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

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

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

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

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

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

      Units of (Custom) Line Items 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.

      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

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

      If empty or not set, the Discount will apply indefinitely.

      Returns:
      triggerPattern
    • getTargetPattern

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

      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