Record Class ProductResponse
java.lang.Object
java.lang.Record
com.dmasone.identity.catalog.interfaces.rest.ProductResponse
public record ProductResponse(Long id, String sku, String name, BigDecimal price, int availableQuantity)
extends Record
HTTP representation of a catalog product. It is separated from the catalog
read projection so REST shape can evolve without changing application
services.
-
Constructor Summary
ConstructorsConstructorDescriptionProductResponse(Long id, String sku, String name, BigDecimal price, int availableQuantity) Creates an instance of aProductResponserecord class. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the value of theavailableQuantityrecord 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.name()Returns the value of thenamerecord component.price()Returns the value of thepricerecord component.sku()Returns the value of theskurecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
ProductResponse
Creates an instance of aProductResponserecord class.- Parameters:
id- the value for theidrecord componentsku- the value for theskurecord componentname- the value for thenamerecord componentprice- the value for thepricerecord componentavailableQuantity- the value for theavailableQuantityrecord 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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
id
Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-
sku
Returns the value of theskurecord component.- Returns:
- the value of the
skurecord component
-
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
price
Returns the value of thepricerecord component.- Returns:
- the value of the
pricerecord component
-
availableQuantity
public int availableQuantity()Returns the value of theavailableQuantityrecord component.- Returns:
- the value of the
availableQuantityrecord component
-