Package com.darkcollective.relix.value
Record Class StructValue
java.lang.Object
java.lang.Record
com.darkcollective.relix.value.StructValue
- Record Components:
fields- the field map; never null, copied defensively and made unmodifiable
- All Implemented Interfaces:
Value
A runtime struct (nested object) value — an ordered map of field name to
Value.
Field names are case-preserved but looked up case-insensitively via
field(String). Equality is structural (two structs are equal when they
have the same fields and values, regardless of field order). Like every nested
value, its type() reports ScalarType.ANY (the dynamic-document
type); pattern-match the Value itself to discover the structural kind.
-
Constructor Summary
ConstructorsConstructorDescriptionStructValue(Map<String, Value> fields) Creates an instance of aStructValuerecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns a human-readable display string for this value, suitable for output formatting.final booleanIndicates whether some other object is "equal to" this one.Returns the value of the field namedname, matched case-insensitively.fields()Returns the value of thefieldsrecord component.final inthashCode()Returns a hash code value for this object.booleanisNull()Returnstrueif this value is null (absent).final StringtoString()Returns a string representation of this record class.type()Returns theScalarTypethat describes this value's kind.
-
Constructor Details
-
StructValue
Creates an instance of aStructValuerecord class.- Parameters:
fields- the value for thefieldsrecord component
-
-
Method Details
-
isNull
public boolean isNull()Description copied from interface:ValueReturnstrueif this value is null (absent). -
type
Description copied from interface:Value -
asDisplayString
Description copied from interface:ValueReturns a human-readable display string for this value, suitable for output formatting.NullValuereturns"NULL".- Specified by:
asDisplayStringin interfaceValue- Returns:
- display string; never
null
-
field
Returns the value of the field namedname, matched case-insensitively.- Parameters:
name- the field name- Returns:
- the field's value, or empty if the struct has no such field
-
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
-