Record Class ProductRequest
java.lang.Object
java.lang.Record
ntnu.idatt2016.v233.SmartMat.dto.request.product.ProductRequest
- Record Components:
ean
- the ean of the productname
- the name of the productdescription
- the description of the productimage
- the image of the productprice
- the price of the productallergies
- the allergies of the product
public record ProductRequest(long ean, String name, String description, String image, double price, List<String> allergies)
extends Record
ProductRequest is a record class representing a request to create a product.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theallergies
record component.Returns the value of thedescription
record component.long
ean()
Returns the value of theean
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.image()
Returns the value of theimage
record component.name()
Returns the value of thename
record component.double
price()
Returns the value of theprice
record component.final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
ProductRequest
public ProductRequest(long ean, String name, String description, String image, double price, List<String> allergies) Creates an instance of aProductRequest
record class.- Parameters:
ean
- the value for theean
record componentname
- the value for thename
record componentdescription
- the value for thedescription
record componentimage
- the value for theimage
record componentprice
- the value for theprice
record componentallergies
- the value for theallergies
record 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 '=='. -
ean
public long ean()Returns the value of theean
record component.- Returns:
- the value of the
ean
record component
-
name
Returns the value of thename
record component.- Returns:
- the value of the
name
record component
-
description
Returns the value of thedescription
record component.- Returns:
- the value of the
description
record component
-
image
Returns the value of theimage
record component.- Returns:
- the value of the
image
record component
-
price
public double price()Returns the value of theprice
record component.- Returns:
- the value of the
price
record component
-
allergies
Returns the value of theallergies
record component.- Returns:
- the value of the
allergies
record component
-