Package dev.frostlake.values
Class VariantValue
java.lang.Object
dev.frostlake.values.VariantValue
- All Implemented Interfaces:
Serializable,Comparable<VariantValue>
Runtime value of the SQL semi-structured family (VARIANT / OBJECT / ARRAY): canonical JSON text
plus a lazily parsed tree.
Equality, ordering and hashing are all over the canonical text — the engine has always compared semi-structured values by their canonical JSON text (GROUP BY, DISTINCT, joins, set operators), and this class preserves exactly those semantics while letting strictly-typed callers (TYPEOF, GET, TO_JSON) know the value really is semi-structured rather than a VARCHAR that happens to look like JSON. Producers canonicalize (sorted object keys, descaled whole decimals) before wrapping; the text is stored verbatim here.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(VariantValue other) The account's VARIANT order — by kind, then within the kind; seeVariantOrder.The key two variants share exactly when they compare equal — numbers by value whatever their notation, objects whatever their key order — seeVariantOrder.comparisonKey(tools.jackson.databind.JsonNode).booleaninthashCode()booleanbooleanA VARIANT JSON null (the textnull) — distinct from SQL NULL.booleantools.jackson.databind.JsonNodenode()The parsed tree (parsed on first access; re-parsed after deserialization).static VariantValueWraps canonical JSON text; the caller guarantees it is valid, canonical JSON.static VariantValueofNode(tools.jackson.databind.JsonNode node) Wraps a parsed tree, rendering its (compact) JSON text once.text()The canonical JSON text.toString()
-
Method Details
-
of
Wraps canonical JSON text; the caller guarantees it is valid, canonical JSON. -
ofNode
Wraps a parsed tree, rendering its (compact) JSON text once. -
text
The canonical JSON text. -
node
public tools.jackson.databind.JsonNode node()The parsed tree (parsed on first access; re-parsed after deserialization). -
isJsonObject
public boolean isJsonObject() -
isJsonArray
public boolean isJsonArray() -
isJsonNull
public boolean isJsonNull()A VARIANT JSON null (the textnull) — distinct from SQL NULL. -
toString
-
comparisonKey
The key two variants share exactly when they compare equal — numbers by value whatever their notation, objects whatever their key order — seeVariantOrder.comparisonKey(tools.jackson.databind.JsonNode). -
equals
-
hashCode
public int hashCode() -
compareTo
The account's VARIANT order — by kind, then within the kind; seeVariantOrder.- Specified by:
compareToin interfaceComparable<VariantValue>
-