Interface Parcel

All Superinterfaces:
Customizable<Parcel>, ParcelMixin

public interface Parcel extends ParcelMixin, Customizable<Parcel>

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


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()
 
  • Method Details

    • getId

      @NotNull @NotNull String getId()

      Unique identifier of the Parcel.

      Returns:
      id
    • getKey

      String getKey()

      User-defined unique identifier of the Parcel.

      Returns:
      key
    • getCreatedAt

      @NotNull @NotNull ZonedDateTime getCreatedAt()

      Date and time (UTC) the Parcel was created.

      Returns:
      createdAt
    • getMeasurements

      @Valid @Valid ParcelMeasurements getMeasurements()

      Information about the dimensions of the Parcel.

      Specified by:
      getMeasurements in interface ParcelMixin
      Returns:
      measurements
    • getTrackingData

      @Valid @Valid TrackingData getTrackingData()

      Shipment tracking information of the Parcel.

      Specified by:
      getTrackingData in interface ParcelMixin
      Returns:
      trackingData
    • getItems

      @Valid @Valid List<DeliveryItem> getItems()

      Line Items or Custom Line Items delivered in this Parcel.

      Specified by:
      getItems in interface ParcelMixin
      Returns:
      items
    • getCustom

      @Valid @Valid CustomFields getCustom()

      Custom Fields of the Parcel.

      Specified by:
      getCustom in interface Customizable<Parcel>
      Specified by:
      getCustom in interface ParcelMixin
      Returns:
      custom
    • setId

      void setId(String id)

      Unique identifier of the Parcel.

      Parameters:
      id - value to be set
    • setKey

      void setKey(String key)

      User-defined unique identifier of the Parcel.

      Parameters:
      key - value to be set
    • setCreatedAt

      void setCreatedAt(ZonedDateTime createdAt)

      Date and time (UTC) the Parcel was created.

      Parameters:
      createdAt - value to be set
    • setMeasurements

      void setMeasurements(ParcelMeasurements measurements)

      Information about the dimensions of the Parcel.

      Parameters:
      measurements - value to be set
    • setTrackingData

      void setTrackingData(TrackingData trackingData)

      Shipment tracking information of the Parcel.

      Parameters:
      trackingData - value to be set
    • setItems

      void setItems(DeliveryItem... items)

      Line Items or Custom Line Items delivered in this Parcel.

      Parameters:
      items - values to be set
    • setItems

      void setItems(List<DeliveryItem> items)

      Line Items or Custom Line Items delivered in this Parcel.

      Parameters:
      items - values to be set
    • setCustom

      void setCustom(CustomFields custom)

      Custom Fields of the Parcel.

      Specified by:
      setCustom in interface Customizable<Parcel>
      Parameters:
      custom - value to be set
    • of

      static Parcel of()
      factory method
      Returns:
      instance of Parcel
    • of

      static Parcel of(Parcel template)
      factory method to create a shallow copy Parcel
      Parameters:
      template - instance to be copied
      Returns:
      copy instance
    • deepCopy

      @Nullable static Parcel deepCopy(@Nullable Parcel template)
      factory method to create a deep copy of Parcel
      Parameters:
      template - instance to be copied
      Returns:
      copy instance
    • builder

      static ParcelBuilder builder()
      builder factory method for Parcel
      Returns:
      builder
    • builder

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

      default <T> T withParcel(Function<Parcel,T> helper)
      accessor map function
      Type Parameters:
      T - mapped type
      Parameters:
      helper - function to map the object
      Returns:
      mapped value
    • typeReference

      static com.fasterxml.jackson.core.type.TypeReference<Parcel> typeReference()
      gives a TypeReference for usage with Jackson DataBind
      Returns:
      TypeReference