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 thedescriptionrecord component.EAN()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.@NonNull Stringname()Returns the value of thenamerecord component.doubleprice()Returns the value of thepricerecord component.intquantity()Returns the value of thequantityrecord component.@NonNull Stringstore()Returns the value of thestorerecord component.Returns the value of thesuggestionrecord component.final StringtoString()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 aItemDTOrecord class.- Parameters:
name- the value for thenamerecord componentdescription- the value for thedescriptionrecord componentstore- the value for thestorerecord componentprice- the value for thepricerecord componentimage- the value for theimagerecord componentquantity- the value for thequantityrecord componentsuggestion- the value for thesuggestionrecord componentEAN- the value for theEANrecord 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 thenamerecord component.- Returns:
- the value of the
namerecord component
-
description
Returns the value of thedescriptionrecord component.- Returns:
- the value of the
descriptionrecord component
-
store
Returns the value of thestorerecord component.- Returns:
- the value of the
storerecord component
-
price
public double price()Returns the value of thepricerecord component.- Returns:
- the value of the
pricerecord component
-
image
Returns the value of theimagerecord component.- Returns:
- the value of the
imagerecord component
-
quantity
public int quantity()Returns the value of thequantityrecord component.- Returns:
- the value of the
quantityrecord component
-
suggestion
Returns the value of thesuggestionrecord component.- Returns:
- the value of the
suggestionrecord component
-
EAN
Returns the value of theEANrecord component.- Returns:
- the value of the
EANrecord component
-