Top Description Fields Constructors Methods
org.h2.value

public final Class ValueJson

extends ValueBytesBase
Class Inheritance
Imports
java.io.ByteArrayOutputStream, java.lang.ref.SoftReference, java.math.BigDecimal, java.nio.charset.StandardCharsets, java.util.Arrays, org.h2.api.ErrorCode, org.h2.message.DbException, org.h2.util.StringUtils, org.h2.util.json.JSONBoolean, .JSONByteArrayTarget, .JSONBytesSource, .JSONItemType, .JSONNull, .JSONNumber, .JSONStringSource, .JSONStringTarget, .JSONValue, .JSONValueTarget

Implementation of the JSON data type.

Field Summary

Modifier and TypeField and Description
private volatile SoftReference<JSONValue>
public static final ValueJson
FALSE

false JSON value.

private static final byte[]
public static final ValueJson
NULL

Hides org.h2.value.Value.NULL.

null JSON value.
private static final byte[]
public static final ValueJson
TRUE

true JSON value.

private static final byte[]
public static final ValueJson
ZERO

0 JSON value.

Inherited from org.h2.value.ValueBytesBase:
hashvalue

Constructor Summary

AccessConstructor and Description
private
ValueJson(byte[] value)

Method Summary

Modifier and TypeMethod and Description
public static ValueJson

Returns:

JSON value
fromJson
(String
JSON representation, will be normalized
s
)

Returns JSON value with the specified content.

public static ValueJson

Returns:

JSON value
fromJson
(byte[]
JSON representation, will be normalized
bytes
)

Returns JSON value with the specified content.

public static ValueJson

Returns:

JSON value
fromJson
(JSONValue
JSON
value
)

Returns JSON value with the specified content.

public static ValueJson

Returns:

JSON value
get
(boolean
boolean value
bool
)

Returns JSON value with the specified boolean content.

public static ValueJson

Returns:

JSON value
get
(int
integer value
number
)

Returns JSON value with the specified numeric content.

public static ValueJson

Returns:

JSON value
get
(long
long value
number
)

Returns JSON value with the specified numeric content.

public static ValueJson

Returns:

JSON value
get
(BigDecimal
big decimal value
number
)

Returns JSON value with the specified numeric content.

public static ValueJson

Returns:

JSON value
get
(String
string value
string
)

Returns JSON value with the specified string content.

public JSONValue

Returns:

decomposed value.
getDecomposition
()

Returns decomposed value.

public static ValueJson

Returns:

JSON value
getInternal
(byte[]
normalized JSON representation
bytes
)

Returns JSON value with the specified content.

public JSONItemType

Returns:

JSON item type
getItemType
()

Returns JSON item type.

public int
getMemory()

Overrides org.h2.value.ValueBytesBase.getMemory.

Get the memory used by this object.

private static ValueJson
public StringBuilder
getSQL(StringBuilder
string builder
builder
,
int
formatting flags
sqlFlags
)

Overrides org.h2.value.ValueBytesBase.getSQL.

Implements org.h2.util.HasSQL.getSQL.

Appends the SQL statement of this object to the specified builder.

public String
getString()

Implements abstract org.h2.value.Value.getString.

Get the value as a string.

public TypeInfo
getType()

Implements abstract org.h2.value.Value.getType.

Implements org.h2.value.Typed.getType.

Returns the data type.

public int
getValueType()

Implements abstract org.h2.value.Value.getValueType.

Get the value type.

Inherited from org.h2.value.ValueBytesBase:
compareTypeSafeequalsgetBytesgetBytesNoCopyhashCode

Field Detail

decompositionRefback to summary
private volatile SoftReference<JSONValue> decompositionRef
FALSEback to summary
public static final ValueJson FALSE

false JSON value.

FALSE_BYTESback to summary
private static final byte[] FALSE_BYTES
NULLback to summary
public static final ValueJson NULL

Hides org.h2.value.Value.NULL.

null JSON value.

NULL_BYTESback to summary
private static final byte[] NULL_BYTES
TRUEback to summary
public static final ValueJson TRUE

true JSON value.

TRUE_BYTESback to summary
private static final byte[] TRUE_BYTES
ZEROback to summary
public static final ValueJson ZERO

0 JSON value.

Constructor Detail

ValueJsonback to summary
private ValueJson(byte[] value)

Method Detail

fromJsonback to summary
public static ValueJson fromJson(String s)

Returns JSON value with the specified content.

Parameters
s:String

JSON representation, will be normalized

Returns:ValueJson

JSON value

Exceptions
DbException:
on invalid JSON
fromJsonback to summary
public static ValueJson fromJson(byte[] bytes)

Returns JSON value with the specified content.

Parameters
bytes:byte[]

JSON representation, will be normalized

Returns:ValueJson

JSON value

Exceptions
DbException:
on invalid JSON
fromJsonback to summary
public static ValueJson fromJson(JSONValue value)

Returns JSON value with the specified content.

Parameters
value:JSONValue

JSON

Returns:ValueJson

JSON value

Exceptions
DbException:
on invalid JSON
getback to summary
public static ValueJson get(boolean bool)

Returns JSON value with the specified boolean content.

Parameters
bool:boolean

boolean value

Returns:ValueJson

JSON value

getback to summary
public static ValueJson get(int number)

Returns JSON value with the specified numeric content.

Parameters
number:int

integer value

Returns:ValueJson

JSON value

getback to summary
public static ValueJson get(long number)

Returns JSON value with the specified numeric content.

Parameters
number:long

long value

Returns:ValueJson

JSON value

getback to summary
public static ValueJson get(BigDecimal number)

Returns JSON value with the specified numeric content.

Parameters
number:BigDecimal

big decimal value

Returns:ValueJson

JSON value

getback to summary
public static ValueJson get(String string)

Returns JSON value with the specified string content.

Parameters
string:String

string value

Returns:ValueJson

JSON value

getDecompositionback to summary
public JSONValue getDecomposition()

Returns decomposed value.

Returns:JSONValue

decomposed value.

getInternalback to summary
public static ValueJson getInternal(byte[] bytes)

Returns JSON value with the specified content.

Parameters
bytes:byte[]

normalized JSON representation

Returns:ValueJson

JSON value

getItemTypeback to summary
public JSONItemType getItemType()

Returns JSON item type.

Returns:JSONItemType

JSON item type

getMemoryback to summary
public int getMemory()

Overrides org.h2.value.ValueBytesBase.getMemory.

Doc from org.h2.value.Value.getMemory.

Get the memory used by this object.

Returns:int

the memory used in bytes

Annotations
@Override
getNumberback to summary
private static ValueJson getNumber(String s)
getSQLback to summary
public StringBuilder getSQL(StringBuilder builder, int sqlFlags)

Overrides org.h2.value.ValueBytesBase.getSQL.

Implements org.h2.util.HasSQL.getSQL.

Doc from org.h2.util.HasSQL.getSQL.

Appends the SQL statement of this object to the specified builder.

Parameters
builder:StringBuilder

string builder

sqlFlags:int

formatting flags

Returns:StringBuilder

the specified string builder

Annotations
@Override
getStringback to summary
public String getString()

Implements abstract org.h2.value.Value.getString.

Doc from org.h2.value.Value.getString.

Get the value as a string.

Returns:String

the string

Annotations
@Override
getTypeback to summary
public TypeInfo getType()

Implements abstract org.h2.value.Value.getType.

Implements org.h2.value.Typed.getType.

Doc from org.h2.value.Typed.getType.

Returns the data type.

Returns:TypeInfo

the data type

Annotations
@Override
getValueTypeback to summary
public int getValueType()

Implements abstract org.h2.value.Value.getValueType.

Doc from org.h2.value.Value.getValueType.

Get the value type.

Returns:int

the value type

Annotations
@Override