Class DirectDiscountBuilder

java.lang.Object
com.commercetools.api.models.cart.DirectDiscountBuilder
All Implemented Interfaces:
io.vrap.rmf.base.client.Builder<DirectDiscount>

public class DirectDiscountBuilder extends Object implements io.vrap.rmf.base.client.Builder<DirectDiscount>
DirectDiscountBuilder
Example to create an instance using the builder pattern

     DirectDiscount directDiscount = DirectDiscount.builder()
             .id("{id}")
             .value(valueBuilder -> valueBuilder)
             .build()
 
  • Constructor Details

    • DirectDiscountBuilder

      public DirectDiscountBuilder()
  • Method Details

    • id

      public DirectDiscountBuilder id(String id)

      Unique identifier of the Direct Discount.

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

      Effect of the Discount on the Cart.

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

      public DirectDiscountBuilder value(Function<CartDiscountValueBuilder,io.vrap.rmf.base.client.Builder<? extends CartDiscountValue>> builder)

      Effect of the Discount on the Cart.

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

      Segment of the Cart that is discounted.

      Empty when the value is set to giftLineItem.

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

      public DirectDiscountBuilder target(Function<CartDiscountTargetBuilder,io.vrap.rmf.base.client.Builder<? extends CartDiscountTarget>> builder)

      Segment of the Cart that is discounted.

      Empty when the value is set to giftLineItem.

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

      public String getId()

      Unique identifier of the Direct Discount.

      Returns:
      id
    • getValue

      public CartDiscountValue getValue()

      Effect of the Discount on the Cart.

      Returns:
      value
    • getTarget

      @Nullable public CartDiscountTarget getTarget()

      Segment of the Cart that is discounted.

      Empty when the value is set to giftLineItem.

      Returns:
      target
    • build

      public DirectDiscount build()
      builds DirectDiscount with checking for non-null required values
      Specified by:
      build in interface io.vrap.rmf.base.client.Builder<DirectDiscount>
      Returns:
      DirectDiscount
    • buildUnchecked

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

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

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