Class DeliveryBuilder

java.lang.Object
com.commercetools.api.models.order.DeliveryBuilder
All Implemented Interfaces:
Builder<Delivery>

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

     Delivery delivery = Delivery.builder()
             .id("{id}")
             .createdAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
             .plusItems(itemsBuilder -> itemsBuilder)
             .plusParcels(parcelsBuilder -> parcelsBuilder)
             .build()
 
  • Constructor Details

    • DeliveryBuilder

      public DeliveryBuilder()
  • Method Details

    • id

      public DeliveryBuilder id(String id)

      Unique identifier of the Delivery.

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

      public DeliveryBuilder key(@Nullable String key)

      User-defined unique identifier of the Delivery.

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

      public DeliveryBuilder createdAt(ZonedDateTime createdAt)

      Date and time (UTC) the Delivery was created.

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

      public DeliveryBuilder items(DeliveryItem... items)

      Line Items or Custom Line Items that are delivered.

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

      public DeliveryBuilder items(List<DeliveryItem> items)

      Line Items or Custom Line Items that are delivered.

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

      public DeliveryBuilder plusItems(DeliveryItem... items)

      Line Items or Custom Line Items that are delivered.

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

      Line Items or Custom Line Items that are delivered.

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

      Line Items or Custom Line Items that are delivered.

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

      Line Items or Custom Line Items that are delivered.

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

      Line Items or Custom Line Items that are delivered.

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

      public DeliveryBuilder parcels(Parcel... parcels)

      Information regarding the appearance, content, and shipment of a Parcel.

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

      public DeliveryBuilder parcels(List<Parcel> parcels)

      Information regarding the appearance, content, and shipment of a Parcel.

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

      public DeliveryBuilder plusParcels(Parcel... parcels)

      Information regarding the appearance, content, and shipment of a Parcel.

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

      public DeliveryBuilder plusParcels(Function<ParcelBuilder,ParcelBuilder> builder)

      Information regarding the appearance, content, and shipment of a Parcel.

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

      public DeliveryBuilder withParcels(Function<ParcelBuilder,ParcelBuilder> builder)

      Information regarding the appearance, content, and shipment of a Parcel.

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

      public DeliveryBuilder addParcels(Function<ParcelBuilder,Parcel> builder)

      Information regarding the appearance, content, and shipment of a Parcel.

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

      public DeliveryBuilder setParcels(Function<ParcelBuilder,Parcel> builder)

      Information regarding the appearance, content, and shipment of a Parcel.

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

      Address to which Parcels are delivered.

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

      public DeliveryBuilder withAddress(Function<AddressBuilder,Address> builder)

      Address to which Parcels are delivered.

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

      public DeliveryBuilder address(@Nullable Address address)

      Address to which Parcels are delivered.

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

      Custom Fields of the Delivery.

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

      Custom Fields of the Delivery.

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

      public DeliveryBuilder custom(@Nullable CustomFields custom)

      Custom Fields of the Delivery.

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

      public String getId()

      Unique identifier of the Delivery.

      Returns:
      id
    • getKey

      @Nullable public String getKey()

      User-defined unique identifier of the Delivery.

      Returns:
      key
    • getCreatedAt

      public ZonedDateTime getCreatedAt()

      Date and time (UTC) the Delivery was created.

      Returns:
      createdAt
    • getItems

      public List<DeliveryItem> getItems()

      Line Items or Custom Line Items that are delivered.

      Returns:
      items
    • getParcels

      public List<Parcel> getParcels()

      Information regarding the appearance, content, and shipment of a Parcel.

      Returns:
      parcels
    • getAddress

      @Nullable public Address getAddress()

      Address to which Parcels are delivered.

      Returns:
      address
    • getCustom

      @Nullable public CustomFields getCustom()

      Custom Fields of the Delivery.

      Returns:
      custom
    • build

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

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

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

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