Record Class OrderCreatedEvent
java.lang.Object
java.lang.Record
com.example.orderplatform.orders.api.OrderCreatedEvent
- Record Components:
orderId- submitted order identifiercustomerId- customer that placed the ordertotalAmount- accepted order total amountcurrency- accepted order total currencyoccurredAt- order creation timestamp
public record OrderCreatedEvent(UUID orderId, UUID customerId, BigDecimal totalAmount, String currency, OffsetDateTime occurredAt)
extends Record
Domain event published after an order is persisted.
Payments use this event to prepare a pending payment record; notifications use it to record a customer-facing notification intent.
-
Constructor Summary
ConstructorsConstructorDescriptionOrderCreatedEvent(UUID orderId, UUID customerId, BigDecimal totalAmount, String currency, OffsetDateTime occurredAt) Creates an instance of aOrderCreatedEventrecord class. -
Method Summary
Modifier and TypeMethodDescriptioncurrency()Returns the value of thecurrencyrecord component.Returns the value of thecustomerIdrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of theoccurredAtrecord component.orderId()Returns the value of theorderIdrecord component.final StringtoString()Returns a string representation of this record class.Returns the value of thetotalAmountrecord component.
-
Constructor Details
-
OrderCreatedEvent
public OrderCreatedEvent(UUID orderId, UUID customerId, BigDecimal totalAmount, String currency, OffsetDateTime occurredAt) Creates an instance of aOrderCreatedEventrecord class.- Parameters:
orderId- the value for theorderIdrecord componentcustomerId- the value for thecustomerIdrecord componenttotalAmount- the value for thetotalAmountrecord componentcurrency- the value for thecurrencyrecord componentoccurredAt- the value for theoccurredAtrecord component
-
-
Method Details
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
orderId
Returns the value of theorderIdrecord component.- Returns:
- the value of the
orderIdrecord component
-
customerId
Returns the value of thecustomerIdrecord component.- Returns:
- the value of the
customerIdrecord component
-
totalAmount
Returns the value of thetotalAmountrecord component.- Returns:
- the value of the
totalAmountrecord component
-
currency
Returns the value of thecurrencyrecord component.- Returns:
- the value of the
currencyrecord component
-
occurredAt
Returns the value of theoccurredAtrecord component.- Returns:
- the value of the
occurredAtrecord component
-