Record Class OrderCreatedEvent

java.lang.Object
java.lang.Record
com.example.orderplatform.orders.api.OrderCreatedEvent
Record Components:
orderId - submitted order identifier
customerId - customer that placed the order
totalAmount - accepted order total amount
currency - accepted order total currency
occurredAt - 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 Details

    • OrderCreatedEvent

      public OrderCreatedEvent(UUID orderId, UUID customerId, BigDecimal totalAmount, String currency, OffsetDateTime occurredAt)
      Creates an instance of a OrderCreatedEvent record class.
      Parameters:
      orderId - the value for the orderId record component
      customerId - the value for the customerId record component
      totalAmount - the value for the totalAmount record component
      currency - the value for the currency record component
      occurredAt - the value for the occurredAt record component
  • Method Details

    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • orderId

      public UUID orderId()
      Returns the value of the orderId record component.
      Returns:
      the value of the orderId record component
    • customerId

      public UUID customerId()
      Returns the value of the customerId record component.
      Returns:
      the value of the customerId record component
    • totalAmount

      public BigDecimal totalAmount()
      Returns the value of the totalAmount record component.
      Returns:
      the value of the totalAmount record component
    • currency

      public String currency()
      Returns the value of the currency record component.
      Returns:
      the value of the currency record component
    • occurredAt

      public OffsetDateTime occurredAt()
      Returns the value of the occurredAt record component.
      Returns:
      the value of the occurredAt record component