Class MultiBuyLineItemsTargetBuilder

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

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

     MultiBuyLineItemsTarget multiBuyLineItemsTarget = MultiBuyLineItemsTarget.builder()
             .predicate("{predicate}")
             .triggerQuantity(1)
             .discountedQuantity(1)
             .selectionMode(SelectionMode.CHEAPEST)
             .build()
 
  • Constructor Details

    • MultiBuyLineItemsTargetBuilder

      public MultiBuyLineItemsTargetBuilder()
  • Method Details

    • predicate

      public MultiBuyLineItemsTargetBuilder predicate(String predicate)

      Valid LineItem target predicate. The Discount will be applied to Line Items that are matched by the predicate.

      Parameters:
      predicate - value to be set
      Returns:
      Builder
    • triggerQuantity

      public MultiBuyLineItemsTargetBuilder triggerQuantity(Integer triggerQuantity)

      Number of Line Items to be present in order to trigger an application of this Discount.

      Parameters:
      triggerQuantity - value to be set
      Returns:
      Builder
    • discountedQuantity

      public MultiBuyLineItemsTargetBuilder discountedQuantity(Integer discountedQuantity)

      Number of Line Items that are discounted per application of this Discount. It must be less than or equal to the triggerQuantity.

      Parameters:
      discountedQuantity - value to be set
      Returns:
      Builder
    • maxOccurrence

      public MultiBuyLineItemsTargetBuilder maxOccurrence(@Nullable Integer maxOccurrence)

      Maximum number of times this Discount can be applied. Do not set if the Discount should be applied an unlimited number of times.

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

      public MultiBuyLineItemsTargetBuilder selectionMode(SelectionMode selectionMode)

      Discounts particular Line Items only according to the SelectionMode.

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

      public String getPredicate()

      Valid LineItem target predicate. The Discount will be applied to Line Items that are matched by the predicate.

      Returns:
      predicate
    • getTriggerQuantity

      public Integer getTriggerQuantity()

      Number of Line Items to be present in order to trigger an application of this Discount.

      Returns:
      triggerQuantity
    • getDiscountedQuantity

      public Integer getDiscountedQuantity()

      Number of Line Items that are discounted per application of this Discount. It must be less than or equal to the triggerQuantity.

      Returns:
      discountedQuantity
    • getMaxOccurrence

      @Nullable public Integer getMaxOccurrence()

      Maximum number of times this Discount can be applied. Do not set if the Discount should be applied an unlimited number of times.

      Returns:
      maxOccurrence
    • getSelectionMode

      public SelectionMode getSelectionMode()

      Discounts particular Line Items only according to the SelectionMode.

      Returns:
      selectionMode
    • build

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

      public MultiBuyLineItemsTarget buildUnchecked()
      builds MultiBuyLineItemsTarget without checking for non-null required values
      Returns:
      MultiBuyLineItemsTarget
    • of

      public static MultiBuyLineItemsTargetBuilder of()
      factory method for an instance of MultiBuyLineItemsTargetBuilder
      Returns:
      builder
    • of

      create builder for MultiBuyLineItemsTarget instance
      Parameters:
      template - instance with prefilled values for the builder
      Returns:
      builder