Record Class Item
java.lang.Object
java.lang.Record
br.net.dd.netherwingcore.common.configuration.structs.Item
This class represents an immutable and structured collection of
Field objects.
It is implemented as a record, providing a concise representation of data with a fixed set of fields.
The Item class allows accessing an embedded Value instance, if present,
among its collection of Field objects.
Usage example:
Field field1 = new SomeField("example");
Value valueField = new Value("value");
Item item = new Item(field1, valueField);
Value retrievedValue = item.getValue();
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.Field[]fields()Returns the value of thefieldsrecord component.getValue()Iterates through the fields contained in thisItemand returns the firstValueinstance encountered.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Item
Creates an instance of aItemrecord class.- Parameters:
fields- the value for thefieldsrecord component
-
-
Method Details
-
getValue
-
toString
-
hashCode
-
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. All components in this record class are compared withObjects::equals(Object,Object). -
fields
Returns the value of thefieldsrecord component.- Returns:
- the value of the
fieldsrecord component
-