Class ReservationBuilder
- All Implemented Interfaces:
Builder<Reservation>
Example to create an instance using the builder pattern
Reservation reservation = Reservation.builder()
.id("{id}")
.version(0.3)
.createdAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
.lastModifiedAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
.expiresAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
.inventoryEntry(inventoryEntryBuilder -> inventoryEntryBuilder)
.quantity(0.3)
.owner(ownerBuilder -> ownerBuilder)
.lineItemId("{lineItemId}")
.state(ReservationState.CREATED)
.build()
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()builds Reservation with checking for non-null required valuesbuilds Reservation without checking for non-null required valuescreatedAt(ZonedDateTime createdAt) Date and time (UTC) the Reservation was initially created.IDs and references that created the Reservation.createdBy(Function<CreatedByBuilder, CreatedByBuilder> builder) IDs and references that created the Reservation.expiresAt(ZonedDateTime expiresAt) Date and time (UTC) the Reservation will no longer be valid.Date and time (UTC) the Reservation was initially created.IDs and references that created the Reservation.Date and time (UTC) the Reservation will no longer be valid.getId()Unique identifier of the Reservation.Reference to the related InventoryEntry used to manage the inventory.Date and time (UTC) the Reservation was last updated.IDs and references that last modified the Reservation.Unique identifier of the LineItem this Reservation is associated with.getOwner()Reference to the owner of the Reservation.The quantity of inventory that is reserved.getState()Current state of the Reservation.Current version of the Reservation.Unique identifier of the Reservation.inventoryEntry(InventoryEntryReference inventoryEntry) Reference to the related InventoryEntry used to manage the inventory.Reference to the related InventoryEntry used to manage the inventory.lastModifiedAt(ZonedDateTime lastModifiedAt) Date and time (UTC) the Reservation was last updated.lastModifiedBy(LastModifiedBy lastModifiedBy) IDs and references that last modified the Reservation.IDs and references that last modified the Reservation.lineItemId(String lineItemId) Unique identifier of the LineItem this Reservation is associated with.static ReservationBuilderof()factory method for an instance of ReservationBuilderstatic ReservationBuilderof(Reservation template) create builder for Reservation instanceReference to the owner of the Reservation.owner(Function<ReferenceBuilder, Builder<? extends Reference>> builder) Reference to the owner of the Reservation.The quantity of inventory that is reserved.state(ReservationState state) Current state of the Reservation.Current version of the Reservation.withCreatedBy(Function<CreatedByBuilder, CreatedBy> builder) IDs and references that created the Reservation.Reference to the related InventoryEntry used to manage the inventory.IDs and references that last modified the Reservation.
-
Constructor Details
-
ReservationBuilder
public ReservationBuilder()
-
-
Method Details
-
id
Unique identifier of the Reservation.
- Parameters:
id- value to be set- Returns:
- Builder
-
version
Current version of the Reservation.
- Parameters:
version- value to be set- Returns:
- Builder
-
createdAt
Date and time (UTC) the Reservation was initially created.
- Parameters:
createdAt- value to be set- Returns:
- Builder
-
lastModifiedAt
Date and time (UTC) the Reservation was last updated.
- Parameters:
lastModifiedAt- value to be set- Returns:
- Builder
-
expiresAt
Date and time (UTC) the Reservation will no longer be valid. It can take a few minutes after expiry for the
stateto be updated toExpiredand the stock to be released.- Parameters:
expiresAt- value to be set- Returns:
- Builder
-
lastModifiedBy
public ReservationBuilder lastModifiedBy(Function<LastModifiedByBuilder, LastModifiedByBuilder> builder) IDs and references that last modified the Reservation.
- Parameters:
builder- function to build the lastModifiedBy value- Returns:
- Builder
-
withLastModifiedBy
public ReservationBuilder withLastModifiedBy(Function<LastModifiedByBuilder, LastModifiedBy> builder) IDs and references that last modified the Reservation.
- Parameters:
builder- function to build the lastModifiedBy value- Returns:
- Builder
-
lastModifiedBy
IDs and references that last modified the Reservation.
- Parameters:
lastModifiedBy- value to be set- Returns:
- Builder
-
createdBy
IDs and references that created the Reservation.
- Parameters:
builder- function to build the createdBy value- Returns:
- Builder
-
withCreatedBy
IDs and references that created the Reservation.
- Parameters:
builder- function to build the createdBy value- Returns:
- Builder
-
createdBy
IDs and references that created the Reservation.
- Parameters:
createdBy- value to be set- Returns:
- Builder
-
inventoryEntry
public ReservationBuilder inventoryEntry(Function<InventoryEntryReferenceBuilder, InventoryEntryReferenceBuilder> builder) Reference to the related InventoryEntry used to manage the inventory.
- Parameters:
builder- function to build the inventoryEntry value- Returns:
- Builder
-
withInventoryEntry
public ReservationBuilder withInventoryEntry(Function<InventoryEntryReferenceBuilder, InventoryEntryReference> builder) Reference to the related InventoryEntry used to manage the inventory.
- Parameters:
builder- function to build the inventoryEntry value- Returns:
- Builder
-
inventoryEntry
Reference to the related InventoryEntry used to manage the inventory.
- Parameters:
inventoryEntry- value to be set- Returns:
- Builder
-
quantity
The quantity of inventory that is reserved.
- Parameters:
quantity- value to be set- Returns:
- Builder
-
owner
Reference to the owner of the Reservation.
- Parameters:
owner- value to be set- Returns:
- Builder
-
owner
Reference to the owner of the Reservation.
- Parameters:
builder- function to build the owner value- Returns:
- Builder
-
lineItemId
Unique identifier of the LineItem this Reservation is associated with.
- Parameters:
lineItemId- value to be set- Returns:
- Builder
-
state
Current state of the Reservation.
- Parameters:
state- value to be set- Returns:
- Builder
-
getId
Unique identifier of the Reservation.
- Returns:
- id
-
getVersion
Current version of the Reservation.
- Returns:
- version
-
getCreatedAt
Date and time (UTC) the Reservation was initially created.
- Returns:
- createdAt
-
getLastModifiedAt
Date and time (UTC) the Reservation was last updated.
- Returns:
- lastModifiedAt
-
getExpiresAt
Date and time (UTC) the Reservation will no longer be valid. It can take a few minutes after expiry for the
stateto be updated toExpiredand the stock to be released.- Returns:
- expiresAt
-
getLastModifiedBy
IDs and references that last modified the Reservation.
- Returns:
- lastModifiedBy
-
getCreatedBy
IDs and references that created the Reservation.
- Returns:
- createdBy
-
getInventoryEntry
Reference to the related InventoryEntry used to manage the inventory.
- Returns:
- inventoryEntry
-
getQuantity
The quantity of inventory that is reserved.
- Returns:
- quantity
-
getOwner
Reference to the owner of the Reservation.
- Returns:
- owner
-
getLineItemId
Unique identifier of the LineItem this Reservation is associated with.
- Returns:
- lineItemId
-
getState
Current state of the Reservation.
- Returns:
- state
-
build
builds Reservation with checking for non-null required values- Specified by:
buildin interfaceBuilder<Reservation>- Returns:
- Reservation
-
buildUnchecked
builds Reservation without checking for non-null required values- Returns:
- Reservation
-
of
factory method for an instance of ReservationBuilder- Returns:
- builder
-
of
create builder for Reservation instance- Parameters:
template- instance with prefilled values for the builder- Returns:
- builder
-