Package de.chojo.universalis.entities
Record Class Item
java.lang.Object
java.lang.Record
de.chojo.universalis.entities.Item
- Record Components:
id- idname- name
Represents an item. Includes localised names.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Itembuild(NameSupplier nameSupplier, int id) Creates an item based on an id and retrieves the names vie the supplierbooleanIndicates whether some other object is "equal to" this one.inthashCode()Returns a hash code value for this object.intid()Returns the value of theidrecord component.name()Returns the value of thenamerecord component.static ItemofId(int id) Create a new item by id with an empty namefinal StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Method Details
-
build
Creates an item based on an id and retrieves the names vie the supplier- Parameters:
nameSupplier- name supplierid- item id- Returns:
- item
-
ofId
Create a new item by id with an empty name- Parameters:
id- id- Returns:
- new item instance
-
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 '=='. -
hashCode
public int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
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. -
id
public int id()Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-