Class PriceTierBuilder

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

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

     PriceTier priceTier = PriceTier.builder()
             .minimumQuantity(0.3)
             .value(valueBuilder -> valueBuilder)
             .build()
 
  • Constructor Details

    • PriceTierBuilder

      public PriceTierBuilder()
  • Method Details

    • minimumQuantity

      public PriceTierBuilder 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.

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

      public PriceTierBuilder value(TypedMoney value)

      Money value that applies when the minimumQuantity is greater than or equal to the LineItem quantity.

      The currencyCode of a Price tier is always the same as the currencyCode in the value of the related Price.

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

      public PriceTierBuilder value(Function<TypedMoneyBuilder,Builder<? extends TypedMoney>> builder)

      Money value that applies when the minimumQuantity is greater than or equal to the LineItem quantity.

      The currencyCode of a Price tier is always the same as the currencyCode in the value of the related Price.

      Parameters:
      builder - function to build the value value
      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.

      Returns:
      minimumQuantity
    • getValue

      public TypedMoney getValue()

      Money value that applies when the minimumQuantity is greater than or equal to the LineItem quantity.

      The currencyCode of a Price tier is always the same as the currencyCode in the value of the related Price.

      Returns:
      value
    • build

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

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

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

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