Package com.darkcollective.relix.value
Record Class ArrayValue
java.lang.Object
java.lang.Record
com.darkcollective.relix.value.ArrayValue
- Record Components:
elements- the element list; never null, copied defensively
- All Implemented Interfaces:
Value
A runtime array value — an ordered list of
Value elements.
Equality is structural and order-sensitive. Like every nested value, its
type() reports ScalarType.ANY (the dynamic-document type);
pattern-match the Value itself to discover the structural kind. Elements
are themselves Values (including NullValue for JSON null).
-
Constructor Summary
ConstructorsConstructorDescriptionArrayValue(List<Value> elements) Creates an instance of aArrayValuerecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns a human-readable display string for this value, suitable for output formatting.at(int index) Returns the element atindex, or empty if the index is out of range.elements()Returns the value of theelementsrecord component.final booleanIndicates whether some other object is "equal to" this one.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
-
ArrayValue
Creates an instance of aArrayValuerecord class.- Parameters:
elements- the value for theelementsrecord 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
-
at
Returns the element atindex, or empty if the index is out of range.- Parameters:
index- a zero-based index- Returns:
- the element, or empty if
index < 0orindex >= size
-
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). -
elements
Returns the value of theelementsrecord component.- Returns:
- the value of the
elementsrecord component
-