Class DirectDiscountDraftBuilder

java.lang.Object
com.commercetools.api.models.cart.DirectDiscountDraftBuilder
All Implemented Interfaces:
Builder<DirectDiscountDraft>

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

     DirectDiscountDraft directDiscountDraft = DirectDiscountDraft.builder()
             .value(valueBuilder -> valueBuilder)
             .build()
 
  • Constructor Details

    • DirectDiscountDraftBuilder

      public DirectDiscountDraftBuilder()
  • Method Details

    • value

      Defines the effect the Discount will have.

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

      Defines the effect the Discount will have.

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

      public DirectDiscountDraftBuilder target(@Nullable CartDiscountTarget target)

      Defines what segment of the Cart will be discounted.

      If value is set to giftLineItem, this must not be set.

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

      Defines what segment of the Cart will be discounted.

      If value is set to giftLineItem, this must not be set.

      Parameters:
      builder - function to build the target value
      Returns:
      Builder
    • participateInBestDealSelection

      public DirectDiscountDraftBuilder participateInBestDealSelection(@Nullable Boolean participateInBestDealSelection)
      • If set to true, Direct Discounts compete against Product Discounts to apply the best deal.
      • If set to false, Direct Discounts are ignored when calculating the best deal comparison, and are applied on top of the discount type that offers the best deal.

      This applies only when the DiscountCombinationMode for the Project is BestDeal.

      Parameters:
      participateInBestDealSelection - value to be set
      Returns:
      Builder
    • getValue

      public CartDiscountValueDraft getValue()

      Defines the effect the Discount will have.

      Returns:
      value
    • getTarget

      @Nullable public CartDiscountTarget getTarget()

      Defines what segment of the Cart will be discounted.

      If value is set to giftLineItem, this must not be set.

      Returns:
      target
    • getParticipateInBestDealSelection

      @Nullable public Boolean getParticipateInBestDealSelection()
      • If set to true, Direct Discounts compete against Product Discounts to apply the best deal.
      • If set to false, Direct Discounts are ignored when calculating the best deal comparison, and are applied on top of the discount type that offers the best deal.

      This applies only when the DiscountCombinationMode for the Project is BestDeal.

      Returns:
      participateInBestDealSelection
    • build

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

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

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

      public static DirectDiscountDraftBuilder of(DirectDiscountDraft template)
      create builder for DirectDiscountDraft instance
      Parameters:
      template - instance with prefilled values for the builder
      Returns:
      builder