public abstract class JsonValue
extends java.lang.Object
Constructor and Description |
---|
JsonValue() |
Modifier and Type | Method and Description |
---|---|
static ErrorResponse |
errorResponse(JsonElement document,
DataContext context)
Return a parsed error response.
|
static JsonElement |
formatCall(DataMethodCall call,
DataContext context)
Return an action invocation request body in JSON format.
|
static JsonElement |
formatDocument(DataValue value,
DataContext context)
Return a data value formatted in OData JSON representation.
|
static JsonElement |
formatLink(EntityValue entity,
DataContext context)
Return an entity reference formatted in OData JSON representation.
|
static JsonElement |
fromArray(JsonArray value)
Return the
value argument. |
static JsonElement |
fromBasicList(DataValueList list,
DataContext context)
Return an OData JSON representation of a value list.
|
static JsonElement |
fromBinary(byte[] value)
Return a
JsonString representation of value , using URL-safe base-64 encoding. |
static JsonElement |
fromBoolean(boolean value)
Return a
JsonBoolean representation of value . |
static JsonElement |
fromByte(byte value)
Return a
JsonNumber representation of value . |
static JsonElement |
fromChar(char value)
Return a
JsonString representation of value . |
static JsonElement |
fromComplexList(ComplexValueList list,
DataContext context)
Return an OData JSON representation of a complex list.
|
static JsonElement |
fromComplexValue(ComplexValue complex,
DataContext context)
Return (nullable) An OData JSON representation of a complex value.
|
static JsonElement |
fromDataValue(DataValue value,
DataContext context)
Return (nullable) An OData JSON representation of a data value.
|
static JsonElement |
fromDecimal(java.math.BigDecimal value)
Return a
JsonNumber representation of value . |
static JsonElement |
fromDouble(double value)
Return a
JsonNumber representation of value . |
static JsonElement |
fromEntityList(EntityValueList list,
DataContext context)
Return an OData JSON representation of an entity list.
|
static JsonElement |
fromEntityValue(EntityValue entity,
DataContext context)
Return (nullable) An OData JSON representation of an entity value.
|
static JsonElement |
fromFloat(float value)
Return a
JsonNumber representation of value . |
static JsonElement |
fromInt(int value)
Return a
JsonNumber representation of value . |
static JsonElement |
fromInteger(java.math.BigInteger value)
Return a
JsonNumber representation of value . |
static JsonElement |
fromLong(long value)
Return a
JsonNumber representation of value . |
static JsonElement |
fromNullableBinary(byte[] value)
Return (nullable) A
JsonString representation of value , using URL-safe base-64 encoding. |
static JsonElement |
fromNullableBoolean(java.lang.Boolean value)
Return (nullable) A
JsonBoolean representation of value . |
static JsonElement |
fromNullableByte(java.lang.Byte value)
Return (nullable) A
JsonNumber representation of value . |
static JsonElement |
fromNullableChar(java.lang.Character value)
Return (nullable) A
JsonString representation of value . |
static JsonElement |
fromNullableDecimal(java.math.BigDecimal value)
Return (nullable) A
JsonNumber representation of value . |
static JsonElement |
fromNullableDouble(java.lang.Double value)
Return (nullable) A
JsonNumber representation of value . |
static JsonElement |
fromNullableFloat(java.lang.Float value)
Return (nullable) A
JsonNumber representation of value . |
static JsonElement |
fromNullableInt(java.lang.Integer value)
Return (nullable) A
JsonNumber representation of value . |
static JsonElement |
fromNullableInteger(java.math.BigInteger value)
Return (nullable) A
JsonNumber representation of value . |
static JsonElement |
fromNullableLong(java.lang.Long value)
Return (nullable) A
JsonNumber representation of value . |
static JsonElement |
fromNullableShort(java.lang.Short value)
Return (nullable) A
JsonNumber representation of value . |
static JsonElement |
fromNullableString(java.lang.String value)
Return (nullable) A
JsonString representation of value . |
static JsonElement |
fromObject(JsonObject value)
Return the
value argument. |
static JsonElement |
fromShort(short value)
Return a
JsonNumber representation of value . |
static JsonElement |
fromString(java.lang.String value)
Return a
JsonString representation of value . |
static DataValue |
parseDocument(JsonElement document,
DataType type,
DataContext context)
Return (nullable) A data value (basic, basic list, complex, complex list, entity, entity list) parsed from OData JSON representation.
|
static EntityValue |
parseLink(JsonElement document,
EntityType type,
DataContext context)
Return an entity reference parsed from OData JSON link representation.
|
static EntityValueList |
parseLinks(JsonElement document,
EntityType type,
DataContext context)
Return a list of entity references parsed from OData JSON links representation.
|
static EntityValue |
parseReference(java.lang.String uri,
EntityType entityType,
EntitySet entitySet,
DataContext context)
|
static EntityValue |
parseReference(java.lang.String uri,
EntityType entityType,
EntitySet entitySet,
DataContext context,
boolean binding)
Return an entity reference parsed from OData JSON reference representation.
|
static DataValueList |
toBasicList(JsonElement element,
DataType type,
DataContext context)
Return a value list parsed from OData JSON representation.
|
static byte[] |
toBinary(JsonElement element)
Return binary value parsed from a JSON string.
|
static boolean |
toBoolean(JsonElement element)
Return boolean value parsed from a JSON boolean.
|
static byte |
toByte(JsonElement element)
Return number value parsed from a JSON number (or JSON string).
|
static char |
toChar(JsonElement element)
Return character value parsed from a JSON string.
|
static ComplexValueList |
toComplexList(JsonElement element,
DataType type,
DataContext context)
Return a complex list parsed from OData JSON representation.
|
static ComplexValue |
toComplexValue(JsonElement element,
ComplexType type,
DataContext context)
Return (nullable) A complex value parsed from OData JSON representation.
|
static DataValue |
toDataValue(JsonElement element,
DataType type,
DataContext context)
Return (nullable) A data value parsed from OData JSON representation.
|
static java.math.BigDecimal |
toDecimal(JsonElement element)
Return number value parsed from a JSON number (or JSON string).
|
static double |
toDouble(JsonElement element)
Return number value parsed from a JSON number (or JSON string).
|
static EntityValueList |
toEntityList(JsonElement element,
DataType type,
DataContext context)
Return an entity list parsed from OData JSON representation.
|
static EntityValue |
toEntityValue(JsonElement element,
EntityType type,
DataContext context)
Return (nullable) An entity value parsed from OData JSON representation.
|
static float |
toFloat(JsonElement element)
Return number value parsed from a JSON number (or JSON string).
|
static int |
toInt(JsonElement element)
Return number value parsed from a JSON number (or JSON string).
|
static java.math.BigInteger |
toInteger(JsonElement element)
Return number value parsed from a JSON number (or JSON string).
|
static long |
toLong(JsonElement element)
Return number value parsed from a JSON number (or JSON string).
|
static byte[] |
toNullableBinary(JsonElement element)
Return (nullable) Nullable string value parsed from a JSON string or JSON null.
|
static java.lang.Boolean |
toNullableBoolean(JsonElement element)
Return (nullable) Nullable boolean value parsed from a JSON boolean or JSON null.
|
static java.lang.Byte |
toNullableByte(JsonElement element)
Return (nullable) Nullable number value parsed from a JSON number or JSON null.
|
static java.lang.Character |
toNullableChar(JsonElement element)
Return (nullable) Nullable character value parsed from a JSON string or JSON null.
|
static java.math.BigDecimal |
toNullableDecimal(JsonElement element)
Return (nullable) Nullable number value parsed from a JSON number or JSON null.
|
static java.lang.Double |
toNullableDouble(JsonElement element)
Return (nullable) Nullable number value parsed from a JSON number or JSON null.
|
static java.lang.Float |
toNullableFloat(JsonElement element)
Return (nullable) Nullable number value parsed from a JSON number or JSON null.
|
static java.lang.Integer |
toNullableInt(JsonElement element)
Return (nullable) Nullable number value parsed from a JSON number or JSON null.
|
static java.math.BigInteger |
toNullableInteger(JsonElement element)
Return (nullable) Nullable number value parsed from a JSON number or JSON null.
|
static java.lang.Long |
toNullableLong(JsonElement element)
Return (nullable) Nullable number value parsed from a JSON number or JSON null.
|
static java.lang.Short |
toNullableShort(JsonElement element)
Return (nullable) Nullable number value parsed from a JSON number or JSON null.
|
static java.lang.String |
toNullableString(JsonElement element)
Return (nullable) Nullable string value parsed from a JSON string or JSON null.
|
static short |
toShort(JsonElement element)
Return number value parsed from a JSON number (or JSON string).
|
static java.lang.String |
toString(JsonElement element)
Return string value parsed from a JSON string.
|
public static ErrorResponse errorResponse(JsonElement document, DataContext context)
Return a parsed error response.
document
- Error response in JSON representation.context
- Data context.public static JsonElement formatCall(DataMethodCall call, DataContext context)
Return an action invocation request body in JSON format.
call
- Action invocation.context
- Data context.public static JsonElement formatDocument(DataValue value, DataContext context)
Return a data value formatted in OData JSON representation.
value
- Data value.context
- Data context.public static JsonElement formatLink(EntityValue entity, DataContext context)
Return an entity reference formatted in OData JSON representation.
entity
- Entity value.context
- Data context.public static JsonElement fromArray(JsonArray value)
Return the value
argument.
value
- A JSON array.value
argument.public static JsonElement fromBasicList(DataValueList list, DataContext context)
Return an OData JSON representation of a value list.
list
- Value to be represented in OData JSON format.context
- Data context.public static JsonElement fromBinary(byte[] value)
Return a JsonString
representation of value
, using URL-safe base-64 encoding.
value
- Value to be represented as JSON.JsonString
representation of value
, using URL-safe base-64 encoding.public static JsonElement fromBoolean(boolean value)
Return a JsonBoolean
representation of value
.
value
- Value to be represented as JSON.JsonBoolean
representation of value
.public static JsonElement fromByte(byte value)
Return a JsonNumber
representation of value
.
value
- Value to be represented as JSON.JsonNumber
representation of value
.public static JsonElement fromChar(char value)
Return a JsonString
representation of value
.
value
- Value to be represented as JSON.JsonString
representation of value
.public static JsonElement fromComplexList(ComplexValueList list, DataContext context)
Return an OData JSON representation of a complex list.
list
- Value to be represented in OData JSON format.context
- Data context.public static JsonElement fromComplexValue(ComplexValue complex, DataContext context)
Return (nullable) An OData JSON representation of a complex value.
complex
- (nullable) Value to be represented in OData JSON format.context
- Data context.public static JsonElement fromDataValue(DataValue value, DataContext context)
Return (nullable) An OData JSON representation of a data value.
value
- (nullable) Value to be represented in OData JSON format.context
- Data context.public static JsonElement fromDecimal(java.math.BigDecimal value)
Return a JsonNumber
representation of value
.
value
- Value to be represented as JSON.JsonNumber
representation of value
.public static JsonElement fromDouble(double value)
Return a JsonNumber
representation of value
.
value
- Value to be represented as JSON.JsonNumber
representation of value
.public static JsonElement fromEntityList(EntityValueList list, DataContext context)
Return an OData JSON representation of an entity list.
list
- Value to be represented in OData JSON format.context
- Data context.public static JsonElement fromEntityValue(EntityValue entity, DataContext context)
Return (nullable) An OData JSON representation of an entity value.
entity
- (nullable) Value to be represented in OData JSON format.context
- Data context.public static JsonElement fromFloat(float value)
Return a JsonNumber
representation of value
.
value
- Value to be represented as JSON.JsonNumber
representation of value
.public static JsonElement fromInt(int value)
Return a JsonNumber
representation of value
.
value
- Value to be represented as JSON.JsonNumber
representation of value
.public static JsonElement fromInteger(java.math.BigInteger value)
Return a JsonNumber
representation of value
.
value
- Value to be represented as JSON.JsonNumber
representation of value
.public static JsonElement fromLong(long value)
Return a JsonNumber
representation of value
.
value
- Value to be represented as JSON.JsonNumber
representation of value
.public static JsonElement fromNullableBinary(byte[] value)
Return (nullable) A JsonString
representation of value
, using URL-safe base-64 encoding.
value
- (nullable) Value to be represented as JSON.JsonString
representation of value
, using URL-safe base-64 encoding.public static JsonElement fromNullableBoolean(java.lang.Boolean value)
Return (nullable) A JsonBoolean
representation of value
.
value
- (nullable) Value to be represented as JSON.JsonBoolean
representation of value
.public static JsonElement fromNullableByte(java.lang.Byte value)
Return (nullable) A JsonNumber
representation of value
.
value
- (nullable) Value to be represented as JSON.JsonNumber
representation of value
.public static JsonElement fromNullableChar(java.lang.Character value)
Return (nullable) A JsonString
representation of value
.
value
- (nullable) Value to be represented as JSON.JsonString
representation of value
.public static JsonElement fromNullableDecimal(java.math.BigDecimal value)
Return (nullable) A JsonNumber
representation of value
.
value
- (nullable) Value to be represented as JSON.JsonNumber
representation of value
.public static JsonElement fromNullableDouble(java.lang.Double value)
Return (nullable) A JsonNumber
representation of value
.
value
- (nullable) Value to be represented as JSON.JsonNumber
representation of value
.public static JsonElement fromNullableFloat(java.lang.Float value)
Return (nullable) A JsonNumber
representation of value
.
value
- (nullable) Value to be represented as JSON.JsonNumber
representation of value
.public static JsonElement fromNullableInt(java.lang.Integer value)
Return (nullable) A JsonNumber
representation of value
.
value
- (nullable) Value to be represented as JSON.JsonNumber
representation of value
.public static JsonElement fromNullableInteger(java.math.BigInteger value)
Return (nullable) A JsonNumber
representation of value
.
value
- (nullable) Value to be represented as JSON.JsonNumber
representation of value
.public static JsonElement fromNullableLong(java.lang.Long value)
Return (nullable) A JsonNumber
representation of value
.
value
- (nullable) Value to be represented as JSON.JsonNumber
representation of value
.public static JsonElement fromNullableShort(java.lang.Short value)
Return (nullable) A JsonNumber
representation of value
.
value
- (nullable) Value to be represented as JSON.JsonNumber
representation of value
.public static JsonElement fromNullableString(java.lang.String value)
Return (nullable) A JsonString
representation of value
.
value
- (nullable) Value to be represented as JSON.JsonString
representation of value
.public static JsonElement fromObject(JsonObject value)
Return the value
argument.
value
- A JSON object.value
argument.public static JsonElement fromShort(short value)
Return a JsonNumber
representation of value
.
value
- Value to be represented as JSON.JsonNumber
representation of value
.public static JsonElement fromString(java.lang.String value)
Return a JsonString
representation of value
.
value
- Value to be represented as JSON.JsonString
representation of value
.public static DataValue parseDocument(JsonElement document, DataType type, DataContext context)
Return (nullable) A data value (basic, basic list, complex, complex list, entity, entity list) parsed from OData JSON representation.
document
- (nullable) Value in JSON representation.type
- Data type for the expected parsed result.context
- Data context.public static EntityValue parseLink(JsonElement document, EntityType type, DataContext context)
Return an entity reference parsed from OData JSON link representation.
The reference will have EntityValue.isReference
== true
, EntityValue.readLink
!= null
,
and EntityValue.hasKey
will be true if the URI was in canonical URL format.
document
- Value in JSON representation.type
- Entity type for the expected parsed result.context
- Data context.public static EntityValueList parseLinks(JsonElement document, EntityType type, DataContext context)
Return a list of entity references parsed from OData JSON links representation.
Each reference will have EntityValue.isReference
== true
, EntityValue.readLink
!= null
,
and EntityValue.hasKey
will be true if the URI was in canonical URL format.
document
- Value in JSON representation.type
- Entity type for the expected parsed result.context
- Data context.public static EntityValue parseReference(java.lang.String uri, EntityType entityType, EntitySet entitySet, DataContext context)
uri
- Uri parameter.entityType
- EntityType parameter.entitySet
- EntitySet parameter.context
- Context parameter.public static EntityValue parseReference(java.lang.String uri, EntityType entityType, EntitySet entitySet, DataContext context, boolean binding)
Return an entity reference parsed from OData JSON reference representation.
The reference will have EntityValue.isReference
== true
, EntityValue.readLink
!= null
,
and EntityValue.hasKey
will be true if the URI was in canonical URL format.
uri
- Entity reference URI.entityType
- Entity type for the expected parsed result.entitySet
- Entity set for the expected parsed result.context
- Data context.binding
- Is the reference for a "bind operation"?public static DataValueList toBasicList(JsonElement element, DataType type, DataContext context)
Return a value list parsed from OData JSON representation.
element
- (nullable) Element in JSON representation.type
- Data type for the expected parsed result.context
- Data context.public static byte[] toBinary(JsonElement element)
Return binary value parsed from a JSON string.
element
- (nullable) Element, which is expected to have type JsonString
, and be in base-64 format.public static boolean toBoolean(JsonElement element)
Return boolean value parsed from a JSON boolean.
element
- (nullable) Element, which is expected to have type JsonBoolean
.public static byte toByte(JsonElement element)
Return number value parsed from a JSON number (or JSON string).
element
- (nullable) Element, which is expected to have type JsonNumber
.public static char toChar(JsonElement element)
Return character value parsed from a JSON string.
element
- (nullable) Element, which is expected to have type JsonString
.public static ComplexValueList toComplexList(JsonElement element, DataType type, DataContext context)
Return a complex list parsed from OData JSON representation.
element
- (nullable) Element in JSON representation.type
- Data type for the expected parsed result.context
- Data context.public static ComplexValue toComplexValue(JsonElement element, ComplexType type, DataContext context)
Return (nullable) A complex value parsed from OData JSON representation.
element
- (nullable) Element in JSON representation.type
- Data type for the expected parsed result.context
- Data context.public static DataValue toDataValue(JsonElement element, DataType type, DataContext context)
Return (nullable) A data value parsed from OData JSON representation.
element
- (nullable) Element in JSON representation.type
- Data type for the expected parsed result.context
- Data context.public static java.math.BigDecimal toDecimal(JsonElement element)
Return number value parsed from a JSON number (or JSON string).
element
- (nullable) Element, which is expected to have type JsonNumber
.public static double toDouble(JsonElement element)
Return number value parsed from a JSON number (or JSON string).
element
- (nullable) Element, which is expected to have type JsonNumber
.public static EntityValueList toEntityList(JsonElement element, DataType type, DataContext context)
Return an entity list parsed from OData JSON representation.
element
- (nullable) Element in JSON representation.type
- Data type for the expected parsed result.context
- Data context.public static EntityValue toEntityValue(JsonElement element, EntityType type, DataContext context)
Return (nullable) An entity value parsed from OData JSON representation.
element
- (nullable) Element in JSON representation.type
- Data type for the expected parsed result.context
- Data context.public static float toFloat(JsonElement element)
Return number value parsed from a JSON number (or JSON string).
element
- (nullable) Element, which is expected to have type JsonNumber
.public static int toInt(JsonElement element)
Return number value parsed from a JSON number (or JSON string).
element
- (nullable) Element, which is expected to have type JsonNumber
.public static java.math.BigInteger toInteger(JsonElement element)
Return number value parsed from a JSON number (or JSON string).
element
- (nullable) Element, which is expected to have type JsonNumber
.public static long toLong(JsonElement element)
Return number value parsed from a JSON number (or JSON string).
element
- (nullable) Element, which is expected to have type JsonNumber
.public static byte[] toNullableBinary(JsonElement element)
Return (nullable) Nullable string value parsed from a JSON string or JSON null.
element
- (nullable) Element, which is expected to be null
or to have type JsonString
in base-64 format.public static java.lang.Boolean toNullableBoolean(JsonElement element)
Return (nullable) Nullable boolean value parsed from a JSON boolean or JSON null.
element
- (nullable) Element, which is expected to be null
or to have type JsonBoolean
.public static java.lang.Byte toNullableByte(JsonElement element)
Return (nullable) Nullable number value parsed from a JSON number or JSON null.
element
- (nullable) Element, which is expected to be null
or to have type JsonNumber
.public static java.lang.Character toNullableChar(JsonElement element)
Return (nullable) Nullable character value parsed from a JSON string or JSON null.
element
- (nullable) Element, which is expected to be null
or to have type JsonString
.public static java.math.BigDecimal toNullableDecimal(JsonElement element)
Return (nullable) Nullable number value parsed from a JSON number or JSON null.
element
- (nullable) Element, which is expected to be null
or to have type JsonNumber
.public static java.lang.Double toNullableDouble(JsonElement element)
Return (nullable) Nullable number value parsed from a JSON number or JSON null.
element
- (nullable) Element, which is expected to be null
or to have type JsonNumber
.public static java.lang.Float toNullableFloat(JsonElement element)
Return (nullable) Nullable number value parsed from a JSON number or JSON null.
element
- (nullable) Element, which is expected to be null
or to have type JsonNumber
.public static java.lang.Integer toNullableInt(JsonElement element)
Return (nullable) Nullable number value parsed from a JSON number or JSON null.
element
- (nullable) Element, which is expected to be null
or to have type JsonNumber
.public static java.math.BigInteger toNullableInteger(JsonElement element)
Return (nullable) Nullable number value parsed from a JSON number or JSON null.
element
- (nullable) Element, which is expected to be null
or to have type JsonNumber
.public static java.lang.Long toNullableLong(JsonElement element)
Return (nullable) Nullable number value parsed from a JSON number or JSON null.
element
- (nullable) Element, which is expected to be null
or to have type JsonNumber
.public static java.lang.Short toNullableShort(JsonElement element)
Return (nullable) Nullable number value parsed from a JSON number or JSON null.
element
- (nullable) Element, which is expected to be null
or to have type JsonNumber
.public static java.lang.String toNullableString(JsonElement element)
Return (nullable) Nullable string value parsed from a JSON string or JSON null.
element
- (nullable) Element, which is expected to be null
or to have type JsonString
.public static short toShort(JsonElement element)
Return number value parsed from a JSON number (or JSON string).
element
- (nullable) Element, which is expected to have type JsonNumber
.public static java.lang.String toString(JsonElement element)
Return string value parsed from a JSON string.
element
- (nullable) Element, which is expected to have type JsonString
.