Record Class ItemDTO
java.lang.Object
java.lang.Record
edu.ntnu.idatt2106_2023_06.backend.dto.items.ItemDTO
- Record Components:
name
- Name of item, given as a Stringdescription
- Description, given as a Stringstore
- Name of store, given as a Stringprice
- Price of item, given as a doubleimage
- Link of image, given as a Stringquantity
- Quantity of items, given as int
public record ItemDTO(@NonNull String name, String description, @NonNull String store, double price, String image, int quantity, Boolean suggestion, String EAN)
extends Record
A DTO representing an item.
This method contains information such as name, description, store, price, purchase date, expiration date, image,
and quantity.
- Author:
- Trym Hamer Gudvangen
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thedescription
record component.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.@NonNull String
name()
Returns the value of thename
record component.double
price()
Returns the value of theprice
record component.int
quantity()
Returns the value of thequantity
record component.@NonNull String
store()
Returns the value of thestore
record component.Returns the value of thesuggestion
record component.final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
ItemDTO
public ItemDTO(@NonNull @NonNull String name, String description, @NonNull @NonNull String store, double price, String image, int quantity, Boolean suggestion, String EAN) Creates an instance of aItemDTO
record class.- Parameters:
name
- the value for thename
record componentdescription
- the value for thedescription
record componentstore
- the value for thestore
record componentprice
- the value for theprice
record componentimage
- the value for theimage
record componentquantity
- the value for thequantity
record componentsuggestion
- the value for thesuggestion
record componentEAN
- the value for theEAN
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 '=='. -
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
-
store
Returns the value of thestore
record component.- Returns:
- the value of the
store
record component
-
price
public double price()Returns the value of theprice
record component.- Returns:
- the value of the
price
record component
-
image
Returns the value of theimage
record component.- Returns:
- the value of the
image
record component
-
quantity
public int quantity()Returns the value of thequantity
record component.- Returns:
- the value of the
quantity
record component
-
suggestion
Returns the value of thesuggestion
record component.- Returns:
- the value of the
suggestion
record component
-
EAN
Returns the value of theEAN
record component.- Returns:
- the value of the
EAN
record component
-