Class 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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddItems
(Function<DeliveryItemBuilder, DeliveryItem> builder) Line Items or Custom Line Items delivered in this Parcel.build()
builds Parcel with checking for non-null required valuesbuilds Parcel without checking for non-null required valuescreatedAt
(ZonedDateTime createdAt) Date and time (UTC) the Parcel was created.custom
(CustomFields custom) Custom Fields of the Parcel.custom
(Function<CustomFieldsBuilder, CustomFieldsBuilder> builder) Custom Fields of the Parcel.Date and time (UTC) the Parcel was created.Custom Fields of the Parcel.getId()
Unique identifier of the Parcel.getItems()
Line Items or Custom Line Items delivered in this Parcel.getKey()
User-defined unique identifier of the Parcel.Information about the dimensions of the Parcel.Shipment tracking information of the Parcel.Unique identifier of the Parcel.items
(DeliveryItem... items) Line Items or Custom Line Items delivered in this Parcel.items
(List<DeliveryItem> items) Line Items or Custom Line Items delivered in this Parcel.User-defined unique identifier of the Parcel.measurements
(ParcelMeasurements measurements) Information about the dimensions of the Parcel.Information about the dimensions of the Parcel.static ParcelBuilder
of()
factory method for an instance of ParcelBuilderstatic ParcelBuilder
create builder for Parcel instanceplusItems
(DeliveryItem... items) Line Items or Custom Line Items delivered in this Parcel.Line Items or Custom Line Items delivered in this Parcel.setItems
(Function<DeliveryItemBuilder, DeliveryItem> builder) Line Items or Custom Line Items delivered in this Parcel.trackingData
(TrackingData trackingData) Shipment tracking information of the Parcel.Shipment tracking information of the Parcel.withCustom
(Function<CustomFieldsBuilder, CustomFields> builder) Custom Fields of the Parcel.Line Items or Custom Line Items delivered in this Parcel.Information about the dimensions of the Parcel.Shipment tracking information of the Parcel.
-
Constructor Details
-
ParcelBuilder
public ParcelBuilder()
-
-
Method Details
-
id
Unique identifier of the Parcel.
- Parameters:
id
- value to be set- Returns:
- Builder
-
key
User-defined unique identifier of the Parcel.
- Parameters:
key
- value to be set- Returns:
- Builder
-
createdAt
Date and time (UTC) the Parcel was created.
- Parameters:
createdAt
- value to be set- Returns:
- Builder
-
measurements
public ParcelBuilder measurements(Function<ParcelMeasurementsBuilder, ParcelMeasurementsBuilder> builder) Information about the dimensions of the Parcel.
- Parameters:
builder
- function to build the measurements value- Returns:
- Builder
-
withMeasurements
public ParcelBuilder withMeasurements(Function<ParcelMeasurementsBuilder, ParcelMeasurements> builder) Information about the dimensions of the Parcel.
- Parameters:
builder
- function to build the measurements value- Returns:
- Builder
-
measurements
Information about the dimensions of the Parcel.
- Parameters:
measurements
- value to be set- Returns:
- Builder
-
trackingData
Shipment tracking information of the Parcel.
- Parameters:
builder
- function to build the trackingData value- Returns:
- Builder
-
withTrackingData
Shipment tracking information of the Parcel.
- Parameters:
builder
- function to build the trackingData value- Returns:
- Builder
-
trackingData
Shipment tracking information of the Parcel.
- Parameters:
trackingData
- value to be set- Returns:
- Builder
-
items
Line Items or Custom Line Items delivered in this Parcel.
- Parameters:
items
- value to be set- Returns:
- Builder
-
items
Line Items or Custom Line Items delivered in this Parcel.
- Parameters:
items
- value to be set- Returns:
- Builder
-
plusItems
Line Items or Custom Line Items delivered in this Parcel.
- Parameters:
items
- value to be set- Returns:
- Builder
-
plusItems
Line Items or Custom Line Items delivered in this Parcel.
- Parameters:
builder
- function to build the items value- Returns:
- Builder
-
withItems
Line Items or Custom Line Items delivered in this Parcel.
- Parameters:
builder
- function to build the items value- Returns:
- Builder
-
addItems
Line Items or Custom Line Items delivered in this Parcel.
- Parameters:
builder
- function to build the items value- Returns:
- Builder
-
setItems
Line Items or Custom Line Items delivered in this Parcel.
- Parameters:
builder
- function to build the items value- Returns:
- Builder
-
custom
Custom Fields of the Parcel.
- Parameters:
builder
- function to build the custom value- Returns:
- Builder
-
withCustom
Custom Fields of the Parcel.
- Parameters:
builder
- function to build the custom value- Returns:
- Builder
-
custom
Custom Fields of the Parcel.
- Parameters:
custom
- value to be set- Returns:
- Builder
-
getId
Unique identifier of the Parcel.
- Returns:
- id
-
getKey
User-defined unique identifier of the Parcel.
- Returns:
- key
-
getCreatedAt
Date and time (UTC) the Parcel was created.
- Returns:
- createdAt
-
getMeasurements
Information about the dimensions of the Parcel.
- Returns:
- measurements
-
getTrackingData
Shipment tracking information of the Parcel.
- Returns:
- trackingData
-
getItems
Line Items or Custom Line Items delivered in this Parcel.
- Returns:
- items
-
getCustom
Custom Fields of the Parcel.
- Returns:
- custom
-
build
builds Parcel with checking for non-null required values -
buildUnchecked
builds Parcel without checking for non-null required values- Returns:
- Parcel
-
of
factory method for an instance of ParcelBuilder- Returns:
- builder
-
of
create builder for Parcel instance- Parameters:
template
- instance with prefilled values for the builder- Returns:
- builder
-