Package org.h2.value

Class ValueJson

  • All Implemented Interfaces:
    HasSQL, Typed

    public final class ValueJson
    extends ValueBytesBase
    Implementation of the JSON data type.
    • Field Detail

      • NULL_BYTES

        private static final byte[] NULL_BYTES
      • TRUE_BYTES

        private static final byte[] TRUE_BYTES
      • FALSE_BYTES

        private static final byte[] FALSE_BYTES
      • NULL

        public static final ValueJson NULL
        null JSON value.
      • TRUE

        public static final ValueJson TRUE
        true JSON value.
      • FALSE

        public static final ValueJson FALSE
        false JSON value.
      • ZERO

        public static final ValueJson ZERO
        0 JSON value.
    • Constructor Detail

      • ValueJson

        private ValueJson​(byte[] value)
    • Method Detail

      • getSQL

        public java.lang.StringBuilder getSQL​(java.lang.StringBuilder builder,
                                              int sqlFlags)
        Description copied from interface: HasSQL
        Appends the SQL statement of this object to the specified builder.
        Specified by:
        getSQL in interface HasSQL
        Overrides:
        getSQL in class ValueBytesBase
        Parameters:
        builder - string builder
        sqlFlags - formatting flags
        Returns:
        the specified string builder
      • getType

        public TypeInfo getType()
        Description copied from interface: Typed
        Returns the data type.
        Specified by:
        getType in interface Typed
        Specified by:
        getType in class Value
        Returns:
        the data type
      • getValueType

        public int getValueType()
        Description copied from class: Value
        Get the value type.
        Specified by:
        getValueType in class Value
        Returns:
        the value type
      • getString

        public java.lang.String getString()
        Description copied from class: Value
        Get the value as a string.
        Specified by:
        getString in class Value
        Returns:
        the string
      • getItemType

        public JSONItemType getItemType()
        Returns JSON item type.
        Returns:
        JSON item type
      • fromJson

        public static ValueJson fromJson​(java.lang.String s)
        Returns JSON value with the specified content.
        Parameters:
        s - JSON representation, will be normalized
        Returns:
        JSON value
        Throws:
        DbException - on invalid JSON
      • fromJson

        public static ValueJson fromJson​(byte[] bytes)
        Returns JSON value with the specified content.
        Parameters:
        bytes - JSON representation, will be normalized
        Returns:
        JSON value
        Throws:
        DbException - on invalid JSON
      • get

        public static ValueJson get​(boolean bool)
        Returns JSON value with the specified boolean content.
        Parameters:
        bool - boolean value
        Returns:
        JSON value
      • get

        public static ValueJson get​(int number)
        Returns JSON value with the specified numeric content.
        Parameters:
        number - integer value
        Returns:
        JSON value
      • get

        public static ValueJson get​(long number)
        Returns JSON value with the specified numeric content.
        Parameters:
        number - long value
        Returns:
        JSON value
      • get

        public static ValueJson get​(java.math.BigDecimal number)
        Returns JSON value with the specified numeric content.
        Parameters:
        number - big decimal value
        Returns:
        JSON value
      • get

        public static ValueJson get​(java.lang.String string)
        Returns JSON value with the specified string content.
        Parameters:
        string - string value
        Returns:
        JSON value
      • getInternal

        public static ValueJson getInternal​(byte[] bytes)
        Returns JSON value with the specified content.
        Parameters:
        bytes - normalized JSON representation
        Returns:
        JSON value
      • getNumber

        private static ValueJson getNumber​(java.lang.String s)