Package com.order.api02orderscrud.dto
Record Class OrderItemDTO
java.lang.Object
java.lang.Record
com.order.api02orderscrud.dto.OrderItemDTO
public record OrderItemDTO(UUID id, @NotBlank String productName, @NotNull @Min(1L) Integer quantity, @NotNull @Positive BigDecimal unitPrice, BigDecimal subtotal)
extends Record
-
Constructor Summary
ConstructorsConstructorDescriptionOrderItemDTO(UUID id, @NotBlank String productName, @NotNull @Min(1L) Integer quantity, @NotNull @Positive BigDecimal unitPrice, BigDecimal subtotal) Creates an instance of aOrderItemDTOrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal 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.@NotBlank StringReturns the value of theproductNamerecord component.@NotNull @Min(1L) Integerquantity()Returns the value of thequantityrecord component.subtotal()Returns the value of thesubtotalrecord component.final StringtoString()Returns a string representation of this record class.@NotNull @Positive BigDecimalReturns the value of theunitPricerecord component.
-
Constructor Details
-
OrderItemDTO
public OrderItemDTO(UUID id, @NotBlank @NotBlank String productName, @NotNull @Min(1L) @NotNull @Min(1L) Integer quantity, @NotNull @Positive @NotNull @Positive BigDecimal unitPrice, BigDecimal subtotal) Creates an instance of aOrderItemDTOrecord class.- Parameters:
id- the value for theidrecord componentproductName- the value for theproductNamerecord componentquantity- the value for thequantityrecord componentunitPrice- the value for theunitPricerecord componentsubtotal- the value for thesubtotalrecord 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
-
productName
Returns the value of theproductNamerecord component.- Returns:
- the value of the
productNamerecord component
-
quantity
Returns the value of thequantityrecord component.- Returns:
- the value of the
quantityrecord component
-
unitPrice
Returns the value of theunitPricerecord component.- Returns:
- the value of the
unitPricerecord component
-
subtotal
Returns the value of thesubtotalrecord component.- Returns:
- the value of the
subtotalrecord component
-