Class PriceTierDraftBuilder

java.lang.Object
com.commercetools.api.models.common.PriceTierDraftBuilder
All Implemented Interfaces:
Builder<PriceTierDraft>

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

     PriceTierDraft priceTierDraft = PriceTierDraft.builder()
             .minimumQuantity(0.3)
             .value(valueBuilder -> valueBuilder)
             .build()
 
  • Constructor Details

    • PriceTierDraftBuilder

      public PriceTierDraftBuilder()
  • Method Details

    • minimumQuantity

      public PriceTierDraftBuilder minimumQuantity(Long minimumQuantity)

      Minimum quantity this Price tier is valid for.

      The minimum quantity is always greater than or equal to 2. The base Price is interpreted as valid for a minimum quantity equal to 1. A Price or StandalonePrice cannot contain more than one tier with the same minimumQuantity. In the case one of the constraint is not met an InvalidField is returned.

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

      Money value that applies when the minimumQuantity is greater than or equal to the LineItem quantity. To set the money value in high precision, use HighPrecisionMoneyDraft.

      The currencyCode of a Price tier must be the same as the currencyCode in the value of the related Price.

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

      public PriceTierDraftBuilder withValue(Function<MoneyBuilder,Money> builder)

      Money value that applies when the minimumQuantity is greater than or equal to the LineItem quantity. To set the money value in high precision, use HighPrecisionMoneyDraft.

      The currencyCode of a Price tier must be the same as the currencyCode in the value of the related Price.

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

      public PriceTierDraftBuilder value(Money value)

      Money value that applies when the minimumQuantity is greater than or equal to the LineItem quantity. To set the money value in high precision, use HighPrecisionMoneyDraft.

      The currencyCode of a Price tier must be the same as the currencyCode in the value of the related Price.

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

      public Long getMinimumQuantity()

      Minimum quantity this Price tier is valid for.

      The minimum quantity is always greater than or equal to 2. The base Price is interpreted as valid for a minimum quantity equal to 1. A Price or StandalonePrice cannot contain more than one tier with the same minimumQuantity. In the case one of the constraint is not met an InvalidField is returned.

      Returns:
      minimumQuantity
    • getValue

      public Money getValue()

      Money value that applies when the minimumQuantity is greater than or equal to the LineItem quantity. To set the money value in high precision, use HighPrecisionMoneyDraft.

      The currencyCode of a Price tier must be the same as the currencyCode in the value of the related Price.

      Returns:
      value
    • build

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

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

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

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