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 theallergiesrecord component.Returns the value of thedescriptionrecord component.longean()Returns the value of theeanrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.image()Returns the value of theimagerecord component.name()Returns the value of thenamerecord component.doubleprice()Returns the value of thepricerecord component.final StringtoString()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 aProductRequestrecord class.- Parameters:
ean- the value for theeanrecord componentname- the value for thenamerecord componentdescription- the value for thedescriptionrecord componentimage- the value for theimagerecord componentprice- the value for thepricerecord componentallergies- the value for theallergiesrecord 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 theeanrecord component.- Returns:
- the value of the
eanrecord component
-
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
description
Returns the value of thedescriptionrecord component.- Returns:
- the value of the
descriptionrecord component
-
image
Returns the value of theimagerecord component.- Returns:
- the value of the
imagerecord component
-
price
public double price()Returns the value of thepricerecord component.- Returns:
- the value of the
pricerecord component
-
allergies
Returns the value of theallergiesrecord component.- Returns:
- the value of the
allergiesrecord component
-