Class ShippingRateBuilder

java.lang.Object
com.commercetools.api.models.shipping_method.ShippingRateBuilder
All Implemented Interfaces:
Builder<ShippingRate>

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

     ShippingRate shippingRate = ShippingRate.builder()
             .price(priceBuilder -> priceBuilder)
             .plusTiers(tiersBuilder -> tiersBuilder)
             .build()
 
  • Constructor Details

    • ShippingRateBuilder

      public ShippingRateBuilder()
  • Method Details

    • price

      public ShippingRateBuilder price(TypedMoney price)

      Currency amount of the ShippingRate.

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

      public ShippingRateBuilder price(Function<TypedMoneyBuilder,Builder<? extends TypedMoney>> builder)

      Currency amount of the ShippingRate.

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

      public ShippingRateBuilder freeAbove(@Nullable TypedMoney freeAbove)

      Free shipping is applied if the sum of the (Custom) Line Item Prices reaches the specified value.

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

      public ShippingRateBuilder freeAbove(Function<TypedMoneyBuilder,Builder<? extends TypedMoney>> builder)

      Free shipping is applied if the sum of the (Custom) Line Item Prices reaches the specified value.

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

      public ShippingRateBuilder isMatching(@Nullable Boolean isMatching)

      true if the ShippingRate matches given Cart or Location. Only appears in response to requests for Get ShippingMethods for a Cart or Get ShippingMethods for a Location.

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

      public ShippingRateBuilder tiers(ShippingRatePriceTier... tiers)

      Price tiers for the ShippingRate.

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

      Price tiers for the ShippingRate.

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

      public ShippingRateBuilder plusTiers(ShippingRatePriceTier... tiers)

      Price tiers for the ShippingRate.

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

      Price tiers for the ShippingRate.

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

      Price tiers for the ShippingRate.

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

      public TypedMoney getPrice()

      Currency amount of the ShippingRate.

      Returns:
      price
    • getFreeAbove

      @Nullable public TypedMoney getFreeAbove()

      Free shipping is applied if the sum of the (Custom) Line Item Prices reaches the specified value.

      Returns:
      freeAbove
    • getIsMatching

      @Nullable public Boolean getIsMatching()

      true if the ShippingRate matches given Cart or Location. Only appears in response to requests for Get ShippingMethods for a Cart or Get ShippingMethods for a Location.

      Returns:
      isMatching
    • getTiers

      public List<ShippingRatePriceTier> getTiers()

      Price tiers for the ShippingRate.

      Returns:
      tiers
    • build

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

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

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

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