Package dev.grafeo.gwp.types
Record Class GqlRecord
java.lang.Object
java.lang.Record
dev.grafeo.gwp.types.GqlRecord
- Record Components:
fields- the list of fields in order
An ordered collection of named fields (open or closed record).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.fields()Returns the value of thefieldsrecord component.Get a field value by name.final inthashCode()Returns a hash code value for this object.Get a field value by name, throwing if not found.intsize()The number of fields in the record.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
GqlRecord
Creates an instance of aGqlRecordrecord class.- Parameters:
fields- the value for thefieldsrecord component
-
-
Method Details
-
get
Get a field value by name.- Parameters:
name- the field name to look up- Returns:
- an Optional containing the value if found, or empty
-
require
Get a field value by name, throwing if not found.- Parameters:
name- the field name to look up- Returns:
- the field value
- Throws:
IllegalArgumentException- if the field is not found
-
size
public int size()The number of fields in the record.- Returns:
- the field count
-
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. 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
-