Record Class JsonArrayValue
java.lang.Object
java.lang.Record
io.github.mnesimiyilmaz.sql4json.json.JsonArrayValue
- Record Components:
elements- the list of elements in this array
- All Implemented Interfaces:
JsonValue
JSON array value.
-
Constructor Summary
ConstructorsConstructorDescriptionJsonArrayValue(List<JsonValue> elements) Creates an instance of aJsonArrayValuerecord class. -
Method Summary
Modifier and TypeMethodDescriptionasArray()Returns the value as a JSON array (ordered list of values).Returns the value as aBoolean.asNumber()Returns the value as aNumber.asObject()Returns the value as a JSON object (map of field names to values).asString()Returns the value as aString.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.booleanisArray()Returnstrueif this value is a JSON array.booleanReturnstrueif this value is a JSON boolean.booleanisNull()Returnstrueif this value is JSONnull.booleanisNumber()Returnstrueif this value is a JSON number (integer or floating-point).booleanisObject()Returnstrueif this value is a JSON object (key-value map).booleanisString()Returnstrueif this value is a JSON string.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
JsonArrayValue
Creates an instance of aJsonArrayValuerecord class.- Parameters:
elements- the value for theelementsrecord component
-
-
Method Details
-
isNull
public boolean isNull()Description copied from interface:JsonValueReturnstrueif this value is JSONnull. -
isObject
public boolean isObject()Description copied from interface:JsonValueReturnstrueif this value is a JSON object (key-value map). -
isArray
public boolean isArray()Description copied from interface:JsonValueReturnstrueif this value is a JSON array. -
isNumber
public boolean isNumber()Description copied from interface:JsonValueReturnstrueif this value is a JSON number (integer or floating-point). -
isString
public boolean isString()Description copied from interface:JsonValueReturnstrueif this value is a JSON string. -
isBoolean
public boolean isBoolean()Description copied from interface:JsonValueReturnstrueif this value is a JSON boolean. -
asObject
Description copied from interface:JsonValueReturns the value as a JSON object (map of field names to values).- Specified by:
asObjectin interfaceJsonValue- Returns:
- the fields if this is an object, or
Optional.empty()otherwise
-
asArray
Description copied from interface:JsonValueReturns the value as a JSON array (ordered list of values).- Specified by:
asArrayin interfaceJsonValue- Returns:
- the elements if this is an array, or
Optional.empty()otherwise
-
asNumber
Description copied from interface:JsonValueReturns the value as aNumber.- Specified by:
asNumberin interfaceJsonValue- Returns:
- the number if this is a numeric value, or
Optional.empty()otherwise
-
asString
Description copied from interface:JsonValueReturns the value as aString.- Specified by:
asStringin interfaceJsonValue- Returns:
- the string if this is a string value, or
Optional.empty()otherwise
-
asBoolean
Description copied from interface:JsonValueReturns the value as aBoolean.- Specified by:
asBooleanin interfaceJsonValue- Returns:
- the boolean if this is a boolean value, or
Optional.empty()otherwise
-
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
-