Record Class OrderSummary
java.lang.Object
java.lang.Record
com.example.orderplatform.orders.api.OrderSummary
- Record Components:
id- order identifiercustomerId- customer that placed the orderstatus- current order statustotal- order totallines- priced order linescreatedAt- creation timestamp
public record OrderSummary(UUID id, UUID customerId, String status, Money total, List<OrderLineSummary> lines, OffsetDateTime createdAt)
extends Record
Immutable order view returned by the order module and REST layer.
-
Constructor Summary
ConstructorsConstructorDescriptionOrderSummary(UUID id, UUID customerId, String status, Money total, List<OrderLineSummary> lines, OffsetDateTime createdAt) Creates an instance of aOrderSummaryrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thecreatedAtrecord 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.id()Returns the value of theidrecord component.lines()Returns the value of thelinesrecord component.status()Returns the value of thestatusrecord component.final StringtoString()Returns a string representation of this record class.total()Returns the value of thetotalrecord component.
-
Constructor Details
-
OrderSummary
public OrderSummary(UUID id, UUID customerId, String status, Money total, List<OrderLineSummary> lines, OffsetDateTime createdAt) Creates an instance of aOrderSummaryrecord class.- Parameters:
id- the value for theidrecord componentcustomerId- the value for thecustomerIdrecord componentstatus- the value for thestatusrecord componenttotal- the value for thetotalrecord componentlines- the value for thelinesrecord componentcreatedAt- the value for thecreatedAtrecord 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). -
id
Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-
customerId
Returns the value of thecustomerIdrecord component.- Returns:
- the value of the
customerIdrecord component
-
status
Returns the value of thestatusrecord component.- Returns:
- the value of the
statusrecord component
-
total
Returns the value of thetotalrecord component.- Returns:
- the value of the
totalrecord component
-
lines
Returns the value of thelinesrecord component.- Returns:
- the value of the
linesrecord component
-
createdAt
Returns the value of thecreatedAtrecord component.- Returns:
- the value of the
createdAtrecord component
-