Class CartDiscountValueRelativeBuilder

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

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

     CartDiscountValueRelative cartDiscountValueRelative = CartDiscountValueRelative.builder()
             .permyriad(0.3)
             .build()
 
  • Constructor Details

    • CartDiscountValueRelativeBuilder

      public CartDiscountValueRelativeBuilder()
  • Method Details

    • permyriad

      public CartDiscountValueRelativeBuilder permyriad(Long permyriad)

      Fraction (per ten thousand) the price is reduced by. For example, 1000 will result in a 10% price reduction.

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

      public CartDiscountValueRelativeBuilder applicationMode(@Nullable DiscountApplicationMode applicationMode)

      Indicates how the discount applies when using CartDiscountPatternTarget.

      • If the mode is IndividualApplication, the discounted percentage is applied on each unit's price. The units matching the triggerPattern are not considered.
      • If the mode is ProportionateDistribution and EvenDistribution the discounted value is calculated from the total value of the units matching the targetPattern and distributed among the units matching the targetPattern or triggerPattern. These modes are allowed only if CartDiscountPatternTarget triggerPattern is non-empty.
      Parameters:
      applicationMode - value to be set
      Returns:
      Builder
    • getPermyriad

      public Long getPermyriad()

      Fraction (per ten thousand) the price is reduced by. For example, 1000 will result in a 10% price reduction.

      Returns:
      permyriad
    • getApplicationMode

      @Nullable public DiscountApplicationMode getApplicationMode()

      Indicates how the discount applies when using CartDiscountPatternTarget.

      • If the mode is IndividualApplication, the discounted percentage is applied on each unit's price. The units matching the triggerPattern are not considered.
      • If the mode is ProportionateDistribution and EvenDistribution the discounted value is calculated from the total value of the units matching the targetPattern and distributed among the units matching the targetPattern or triggerPattern. These modes are allowed only if CartDiscountPatternTarget triggerPattern is non-empty.
      Returns:
      applicationMode
    • build

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

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

      factory method for an instance of CartDiscountValueRelativeBuilder
      Returns:
      builder
    • of

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