Class DiscountedPriceBuilder

java.lang.Object
com.commercetools.importapi.models.common.DiscountedPriceBuilder
All Implemented Interfaces:
Builder<DiscountedPrice>

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

     DiscountedPrice discountedPrice = DiscountedPrice.builder()
             .value(valueBuilder -> valueBuilder)
             .discount(discountBuilder -> discountBuilder)
             .build()
 
  • Constructor Details

    • DiscountedPriceBuilder

      public DiscountedPriceBuilder()
  • Method Details

    • value

      public DiscountedPriceBuilder value(TypedMoney value)

      Money value of the discounted price.

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

      Money value of the discounted price.

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

      Reference to a ProductDiscount. If the referenced ProductDiscount does not exist, the state of the ImportOperation will be set to unresolved until the referenced ProductDiscount is created.

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

      Reference to a ProductDiscount. If the referenced ProductDiscount does not exist, the state of the ImportOperation will be set to unresolved until the referenced ProductDiscount is created.

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

      Reference to a ProductDiscount. If the referenced ProductDiscount does not exist, the state of the ImportOperation will be set to unresolved until the referenced ProductDiscount is created.

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

      public TypedMoney getValue()

      Money value of the discounted price.

      Returns:
      value
    • getDiscount

      public ProductDiscountKeyReference getDiscount()

      Reference to a ProductDiscount. If the referenced ProductDiscount does not exist, the state of the ImportOperation will be set to unresolved until the referenced ProductDiscount is created.

      Returns:
      discount
    • build

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

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

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

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