Class ParcelBuilder

java.lang.Object
com.commercetools.importapi.models.orders.ParcelBuilder
All Implemented Interfaces:
Builder<Parcel>

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

     Parcel parcel = Parcel.builder()
             .id("{id}")
             .createdAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
             .build()
 
  • Constructor Details

    • ParcelBuilder

      public ParcelBuilder()
  • Method Details

    • id

      public ParcelBuilder id(String id)
      set the value to the id
      Parameters:
      id - value to be set
      Returns:
      Builder
    • createdAt

      public ParcelBuilder createdAt(ZonedDateTime createdAt)
      set the value to the createdAt
      Parameters:
      createdAt - value to be set
      Returns:
      Builder
    • measurements

      set the value to the measurements using the builder function
      Parameters:
      builder - function to build the measurements value
      Returns:
      Builder
    • withMeasurements

      set the value to the measurements using the builder function
      Parameters:
      builder - function to build the measurements value
      Returns:
      Builder
    • measurements

      public ParcelBuilder measurements(@Nullable ParcelMeasurements measurements)
      set the value to the measurements
      Parameters:
      measurements - value to be set
      Returns:
      Builder
    • trackingData

      set the value to the trackingData using the builder function
      Parameters:
      builder - function to build the trackingData value
      Returns:
      Builder
    • withTrackingData

      public ParcelBuilder withTrackingData(Function<TrackingDataBuilder,TrackingData> builder)
      set the value to the trackingData using the builder function
      Parameters:
      builder - function to build the trackingData value
      Returns:
      Builder
    • trackingData

      public ParcelBuilder trackingData(@Nullable TrackingData trackingData)
      set the value to the trackingData
      Parameters:
      trackingData - value to be set
      Returns:
      Builder
    • items

      public ParcelBuilder items(@Nullable DeliveryItem... items)
      set values to the items
      Parameters:
      items - value to be set
      Returns:
      Builder
    • items

      public ParcelBuilder items(@Nullable List<DeliveryItem> items)
      set value to the items
      Parameters:
      items - value to be set
      Returns:
      Builder
    • plusItems

      public ParcelBuilder plusItems(@Nullable DeliveryItem... items)
      add values to the items
      Parameters:
      items - value to be set
      Returns:
      Builder
    • plusItems

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

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

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

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

      The representation to be sent to the server when creating a resource with Custom Fields.

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

      public ParcelBuilder withCustom(Function<CustomBuilder,Custom> builder)

      The representation to be sent to the server when creating a resource with Custom Fields.

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

      public ParcelBuilder custom(@Nullable Custom custom)

      The representation to be sent to the server when creating a resource with Custom Fields.

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

      public String getId()
      value of id}
      Returns:
      id
    • getCreatedAt

      public ZonedDateTime getCreatedAt()
      value of createdAt}
      Returns:
      createdAt
    • getMeasurements

      @Nullable public ParcelMeasurements getMeasurements()
      value of measurements}
      Returns:
      measurements
    • getTrackingData

      @Nullable public TrackingData getTrackingData()
      value of trackingData}
      Returns:
      trackingData
    • getItems

      @Nullable public List<DeliveryItem> getItems()
      value of items}
      Returns:
      items
    • getCustom

      @Nullable public Custom getCustom()

      The representation to be sent to the server when creating a resource with Custom Fields.

      Returns:
      custom
    • build

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

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

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

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