Class ParcelBuilder
java.lang.Object
com.commercetools.history.models.common.ParcelBuilder
ParcelBuilder
Example to create an instance using the builder pattern
Example to create an instance using the builder pattern
Parcel parcel = Parcel.builder()
.id("{id}")
.createdAt("{createdAt}")
.measurements(measurementsBuilder -> measurementsBuilder)
.trackingData(trackingDataBuilder -> trackingDataBuilder)
.plusItems(itemsBuilder -> itemsBuilder)
.build()
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddItems
(Function<DeliveryItemBuilder, DeliveryItem> builder) add the value to the items using the builder functionbuild()
builds Parcel with checking for non-null required valuesbuilds Parcel without checking for non-null required valuesset the value to the createdAtvalue of createdAt}getId()
value of id}getItems()
value of items}value of measurements}value of trackingData}set the value to the iditems
(DeliveryItem... items) set values to the itemsitems
(List<DeliveryItem> items) set value to the itemsmeasurements
(ParcelMeasurements measurements) set the value to the measurementsset the value to the measurements using the builder functionstatic ParcelBuilder
of()
factory method for an instance of ParcelBuilderstatic ParcelBuilder
create builder for Parcel instanceplusItems
(DeliveryItem... items) add values to the itemsadd the value to the items using the builder functionsetItems
(Function<DeliveryItemBuilder, DeliveryItem> builder) set the value to the items using the builder functiontrackingData
(TrackingData trackingData) set the value to the trackingDataset the value to the trackingData using the builder functionset the value to the items using the builder functionset the value to the measurements using the builder functionset the value to the trackingData using the builder function
-
Constructor Details
-
ParcelBuilder
public ParcelBuilder()
-
-
Method Details
-
id
set the value to the id- Parameters:
id
- value to be set- Returns:
- Builder
-
createdAt
set the value to the createdAt- Parameters:
createdAt
- value to be set- Returns:
- Builder
-
measurements
public ParcelBuilder measurements(Function<ParcelMeasurementsBuilder, ParcelMeasurementsBuilder> builder) set the value to the measurements using the builder function- Parameters:
builder
- function to build the measurements value- Returns:
- Builder
-
withMeasurements
public ParcelBuilder withMeasurements(Function<ParcelMeasurementsBuilder, ParcelMeasurements> builder) set the value to the measurements using the builder function- Parameters:
builder
- function to build the measurements value- Returns:
- Builder
-
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
set the value to the trackingData using the builder function- Parameters:
builder
- function to build the trackingData value- Returns:
- Builder
-
trackingData
set the value to the trackingData- Parameters:
trackingData
- value to be set- Returns:
- Builder
-
items
set values to the items- Parameters:
items
- value to be set- Returns:
- Builder
-
items
set value to the items- Parameters:
items
- value to be set- Returns:
- Builder
-
plusItems
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
-
getId
value of id}- Returns:
- id
-
getCreatedAt
value of createdAt}- Returns:
- createdAt
-
getMeasurements
value of measurements}- Returns:
- measurements
-
getTrackingData
value of trackingData}- Returns:
- trackingData
-
getItems
value of items}- Returns:
- items
-
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
-