Class TypedScalarNode

java.lang.Object
tools.jackson.databind.JacksonSerializable.Base
tools.jackson.databind.JsonNode
tools.jackson.databind.node.BaseJsonNode
tools.jackson.databind.node.ValueNode
tools.jackson.databind.node.StringNode
dev.frostlake.values.TypedScalarNode
All Implemented Interfaces:
Serializable, Iterable<tools.jackson.databind.JsonNode>, tools.jackson.core.TreeNode, tools.jackson.databind.JacksonSerializable

public final class TypedScalarNode extends tools.jackson.databind.node.StringNode
A JSON string node that remembers the TYPED value it was rendered from.

Snowflake's VARIANT is a superset of JSON: a DATE, TIME, TIMESTAMP or BINARY keeps its own type inside an OBJECT or ARRAY, so TYPEOF(OBJECT_CONSTRUCT('b', TO_BINARY('CAFE','HEX')):b) is BINARY and AS_BINARY over that member returns the bytes. JSON has no such types — it can only carry the rendered text — so a plain string node loses the distinction.

This node closes that gap without changing a single byte of the JSON text: it IS a string node, so it serializes, canonicalizes, compares and hashes exactly as the text form always did (TO_JSON, ::VARCHAR, OBJECT_KEYS and the stored/WAL text are all untouched). Extraction — ArrayFunctionHelper.fromNode and the colon-path extractor — recognises it and hands back the original typed value instead of the text, which is what makes TYPEOF and the AS_* / IS_* family answer like live.

The typed value rides along in memory only. A variant that has been re-parsed from its canonical text (a persistence or wire round-trip) carries plain string nodes again and reports VARCHAR, the same answer as before this node existed — recovering the type through the text alone would need a tagged wire encoding, which would change what TO_JSON and ::VARCHAR return.

See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from class tools.jackson.databind.JsonNode

    tools.jackson.databind.JsonNode.OverwriteMode

    Nested classes/interfaces inherited from interface tools.jackson.databind.JacksonSerializable

    tools.jackson.databind.JacksonSerializable.Base
  • Field Summary

    Fields inherited from class tools.jackson.databind.node.StringNode

    _value

    Fields inherited from class tools.jackson.databind.node.ValueNode

    BD_MAX_INTEGER, BD_MAX_LONG, BD_MAX_SHORT, BD_MIN_INTEGER, BD_MIN_LONG, BD_MIN_SHORT, BI_MAX_INTEGER, BI_MAX_LONG, BI_MAX_SHORT, BI_MIN_INTEGER, BI_MIN_LONG, BI_MIN_SHORT, MISSING

    Fields inherited from class tools.jackson.databind.node.BaseJsonNode

    OPT_FALSE, OPT_TRUE
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Deep copies keep the type.
    The typed runtime value this member was built from (a BinaryValue, LocalDate, LocalTime, …).
    static Object
    The typed value of node when it carries one, else null.

    Methods inherited from class tools.jackson.databind.node.StringNode

    _asBoolean, _asString, _tryParseAsBigDecimal, _tryParseAsBigInteger, _tryParseAsDouble, _tryParseAsFloat, _tryParseAsInteger, _tryParseAsLong, _tryParseAsShort, _valueDesc, asBigInteger, asBigInteger, asBigIntegerOpt, asDecimal, asDecimal, asDecimalOpt, asDouble, asDouble, asDoubleOpt, asFloat, asFloat, asFloatOpt, asInt, asInt, asIntOpt, asLong, asLong, asLongOpt, asShort, asShort, asShortOpt, asString, asString, asStringOpt, asToken, binaryValue, equals, getBinaryValue, getNodeType, hashCode, serialize, stringValue, stringValue, stringValueOpt, valueOf

    Methods inherited from class tools.jackson.databind.node.ValueNode

    _at, findParent, findParents, findValue, findValues, findValuesAsString, get, get, has, has, hasNonNull, hasNonNull, isEmpty, path, path, serializeWithType

    Methods inherited from class tools.jackson.databind.node.BaseJsonNode

    _jsonPointerIfValid, _reportBigDecimalConversionNaNFail, _reportBigIntegerConversionFractionFail, _reportBigIntegerConversionNaNFail, _reportCoercionFail, _reportCoercionFail, _reportConversionFail, _reportDoubleConversionRangeFail, _reportFloatConversionRangeFail, _reportIntConversionFractionFail, _reportIntConversionNaNFail, _reportIntConversionRangeFail, _reportLongConversionFractionFail, _reportLongConversionNaNFail, _reportLongConversionRangeFail, _reportShortConversionFractionFail, _reportShortConversionRangeFail, _reportWrongNodeType, _withArray, _withObject, _withXxxMayReplace, _withXxxVerifyReplace, asArray, asArrayOpt, asBoolean, asBoolean, asBooleanOpt, asObject, asObjectOpt, bigIntegerValue, bigIntegerValue, bigIntegerValueOpt, booleanValue, booleanValue, booleanValueOpt, decimalValue, decimalValue, decimalValueOpt, doubleValue, doubleValue, doubleValueOpt, findPath, floatValue, floatValue, floatValueOpt, intValue, intValue, intValueOpt, isEmbeddedValue, isMissingNode, longValue, longValue, longValueOpt, numberType, numberValue, required, required, shortValue, shortValue, shortValueOpt, toPrettyString, toString, traverse, withArray, withObject

    Methods inherited from class tools.jackson.databind.JsonNode

    _reportRequiredViolation, _reportUnsupportedOperation, _this, asOptional, asText, asText, at, at, canConvertToExactIntegral, canConvertToInt, canConvertToLong, canConvertToShort, equals, findParents, findValues, findValuesAsString, forEachEntry, isArray, isBigDecimal, isBigInteger, isBinary, isBoolean, isContainer, isDouble, isFloat, isFloatingPointNumber, isInt, isIntegralNumber, isLong, isNull, isNumber, isObject, isPojo, isShort, isString, isTextual, isValueNode, iterator, map, missingAs, missingAs, nullAs, nullAs, optional, optional, properties, propertyNames, propertyStream, require, requiredAt, requiredAt, requireNonNull, size, spliterator, textValue, values, valueStream, withArray, withArray, withArray, withArrayProperty, withObject, withObject, withObject, withObjectProperty

    Methods inherited from class tools.jackson.databind.JacksonSerializable.Base

    isEmpty

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface java.lang.Iterable

    forEach
  • Constructor Details

    • TypedScalarNode

      public TypedScalarNode(String text, Object value)
  • Method Details

    • typedValue

      public Object typedValue()
      The typed runtime value this member was built from (a BinaryValue, LocalDate, LocalTime, …).
    • deepCopy

      public TypedScalarNode deepCopy()
      Deep copies keep the type. Both this node and its value are immutable, so the copy can be the node itself — losing the type here would make a canonicalized or copied container answer VARCHAR while an untouched one answers BINARY.
      Overrides:
      deepCopy in class tools.jackson.databind.node.StringNode
    • typedValueOf

      public static Object typedValueOf(Object node)
      The typed value of node when it carries one, else null.