Class ItemShippingTargetBuilder

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

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

     ItemShippingTarget itemShippingTarget = ItemShippingTarget.builder()
             .addressKey("{addressKey}")
             .quantity(0.3)
             .build()
 
  • Constructor Details

    • ItemShippingTargetBuilder

      public ItemShippingTargetBuilder()
  • Method Details

    • addressKey

      public ItemShippingTargetBuilder addressKey(String addressKey)

      Key of the address in the Cart itemShippingAddresses. Duplicate address keys are not allowed.

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

      public ItemShippingTargetBuilder quantity(Long quantity)

      Quantity of Line Items or Custom Line Items shipped to the address with the specified addressKey.

      If a quantity is updated to 0 when defining ItemShippingDetailsDraft, the targets are removed from a Line Item or Custom Line Item in the resulting ItemShippingDetails.

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

      public ItemShippingTargetBuilder shippingMethodKey(@Nullable String shippingMethodKey)

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

      It connects Line Item or Custom Line Item quantities with individual Shipping Methods.

      Required when the Cart has Multiple ShippingMode. Omitting this field in that case returns an InvalidOperation error.

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

      public String getAddressKey()

      Key of the address in the Cart itemShippingAddresses. Duplicate address keys are not allowed.

      Returns:
      addressKey
    • getQuantity

      public Long getQuantity()

      Quantity of Line Items or Custom Line Items shipped to the address with the specified addressKey.

      If a quantity is updated to 0 when defining ItemShippingDetailsDraft, the targets are removed from a Line Item or Custom Line Item in the resulting ItemShippingDetails.

      Returns:
      quantity
    • getShippingMethodKey

      @Nullable public String getShippingMethodKey()

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

      It connects Line Item or Custom Line Item quantities with individual Shipping Methods.

      Required when the Cart has Multiple ShippingMode. Omitting this field in that case returns an InvalidOperation error.

      Returns:
      shippingMethodKey
    • build

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

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

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

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