Class ShippingBuilder

java.lang.Object
com.commercetools.api.models.cart.ShippingBuilder
All Implemented Interfaces:
Builder<Shipping>

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

     Shipping shipping = Shipping.builder()
             .shippingKey("{shippingKey}")
             .shippingInfo(shippingInfoBuilder -> shippingInfoBuilder)
             .shippingAddress(shippingAddressBuilder -> shippingAddressBuilder)
             .build()
 
  • Constructor Details

    • ShippingBuilder

      public ShippingBuilder()
  • Method Details

    • shippingKey

      public ShippingBuilder shippingKey(String shippingKey)

      User-defined unique identifier of the Shipping in a Cart with Multiple ShippingMode.

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

      Automatically set when the Shipping Method is added.

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

      public ShippingBuilder withShippingInfo(Function<ShippingInfoBuilder,ShippingInfo> builder)

      Automatically set when the Shipping Method is added.

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

      public ShippingBuilder shippingInfo(ShippingInfo shippingInfo)

      Automatically set when the Shipping Method is added.

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

      public ShippingBuilder shippingAddress(Function<AddressBuilder,AddressBuilder> builder)

      Determines the shipping rates and Tax Rates of associated Line Items.

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

      public ShippingBuilder withShippingAddress(Function<AddressBuilder,Address> builder)

      Determines the shipping rates and Tax Rates of associated Line Items.

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

      public ShippingBuilder shippingAddress(Address shippingAddress)

      Determines the shipping rates and Tax Rates of associated Line Items.

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

      public ShippingBuilder shippingRateInput(@Nullable ShippingRateInput shippingRateInput)

      Used as an input to select a ShippingRatePriceTier. The data type of this field depends on the shippingRateInputType.type configured in the Project:

      • If CartClassification, it is ClassificationShippingRateInput.
      • If CartScore, it is ScoreShippingRateInput.
      • If CartValue, it cannot be used.
      Parameters:
      shippingRateInput - value to be set
      Returns:
      Builder
    • shippingRateInput

      public ShippingBuilder shippingRateInput(Function<ShippingRateInputBuilder,Builder<? extends ShippingRateInput>> builder)

      Used as an input to select a ShippingRatePriceTier. The data type of this field depends on the shippingRateInputType.type configured in the Project:

      • If CartClassification, it is ClassificationShippingRateInput.
      • If CartScore, it is ScoreShippingRateInput.
      • If CartValue, it cannot be used.
      Parameters:
      builder - function to build the shippingRateInput value
      Returns:
      Builder
    • shippingCustomFields

      public ShippingBuilder shippingCustomFields(Function<CustomFieldsBuilder,CustomFieldsBuilder> builder)

      Custom Fields of Shipping with Multiple ShippingMode.

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

      public ShippingBuilder withShippingCustomFields(Function<CustomFieldsBuilder,CustomFields> builder)

      Custom Fields of Shipping with Multiple ShippingMode.

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

      public ShippingBuilder shippingCustomFields(@Nullable CustomFields shippingCustomFields)

      Custom Fields of Shipping with Multiple ShippingMode.

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

      public String getShippingKey()

      User-defined unique identifier of the Shipping in a Cart with Multiple ShippingMode.

      Returns:
      shippingKey
    • getShippingInfo

      public ShippingInfo getShippingInfo()

      Automatically set when the Shipping Method is added.

      Returns:
      shippingInfo
    • getShippingAddress

      public Address getShippingAddress()

      Determines the shipping rates and Tax Rates of associated Line Items.

      Returns:
      shippingAddress
    • getShippingRateInput

      @Nullable public ShippingRateInput getShippingRateInput()

      Used as an input to select a ShippingRatePriceTier. The data type of this field depends on the shippingRateInputType.type configured in the Project:

      • If CartClassification, it is ClassificationShippingRateInput.
      • If CartScore, it is ScoreShippingRateInput.
      • If CartValue, it cannot be used.
      Returns:
      shippingRateInput
    • getShippingCustomFields

      @Nullable public CustomFields getShippingCustomFields()

      Custom Fields of Shipping with Multiple ShippingMode.

      Returns:
      shippingCustomFields
    • build

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

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

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

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