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 Item
build
(NameSupplier nameSupplier, int id) Creates an item based on an id and retrieves the names vie the supplierboolean
Indicates whether some other object is "equal to" this one.int
hashCode()
Returns a hash code value for this object.int
id()
Returns the value of theid
record component.name()
Returns the value of thename
record component.static Item
ofId
(int id) Create a new item by id with an empty namefinal String
toString()
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 theid
record component.- Returns:
- the value of the
id
record component
-
name
Returns the value of thename
record component.- Returns:
- the value of the
name
record component
-