public JSONValue
This interface provides convenient methods to browse a JSON value (typically returned by the underlying Javascript engine). In particular, these methods support conversion to native Java types (such as String, Number, Boolean) as well as to POJO (Plain Old Java Objects) types.
Modifier and Type | Field and Description |
---|---|
(package private) static JSONValue |
NULL |
Modifier and Type | Method and Description |
---|---|
(package private) java.lang.Object |
getProperty(java.lang.String property)
If this JSON value is a JSON object, gets the raw Javascript object representing the value of a given property of this JSON object. If this JSON value is not a JSON object or if this JSON object has no property with the given name, then this method returns
null . |
(package private) <T> T |
getPropertyAs(java.lang.String property,
java.lang.Class<T> type)
If this JSON value is a JSON object, gets the value of a given property as an object of a given type. If this JSON value is not a JSON object or if this JSON object has no property with the given name, then this method returns
null . If the conversion is not possible, this method returns null . |
(package private) <T> java.util.List<T> |
getPropertyAsListOf(java.lang.String property,
java.lang.Class<T> type)
If this JSON value is a JSON object, gets the value of a given property as a list of elements of a given type. If this JSON value is not a JSON object or if this JSON object has no property with the given name, then this method returns
null . If the conversion of the given property is not possible (see ), this method returns null . |
(package private) <T> java.util.Map<java.lang.String,T> |
getPropertyAsMapOf(java.lang.String property,
java.lang.Class<T> type)
If this JSON value is a JSON object, gets the value of a given property as an associative map from
String to a given type. If this JSON value is not a JSON object or if this JSON object has no property with the given name, then this method returns null . If the conversion of the given property is not possible (see ), this method returns null . |
(package private) java.lang.Object |
getValue()
Gets the raw Javascript object representing this JSON value.
|
(package private) <T> T |
getValueAs(java.lang.Class<T> type)
Gets this JSON value as an object of a given type. If the conversion is not possible, this method returns
null . |
(package private) <T> java.util.List<T> |
getValueAsListOf(java.lang.Class<T> type)
Gets this JSON value as a list of elements of a given type. If the conversion is not possible (either the JSON value is not a list or one of its elements can't be converted to the given type), this method returns
null . |
(package private) <T> java.util.Map<java.lang.String,T> |
getValueAsMapOf(java.lang.Class<T> type)
Gets this JSON value as an associative map from
String to a given type. If the conversion is not possible (either the JSON value is not a map or one of its values can't be converted to the given type), this method returns null . |
(package private) java.lang.String |
stringify()
Gets a string representation of this JSON value.
|
static JSONValue NULL
java.lang.String stringify()
Gets a string representation of this JSON value.
java.lang.Object getValue()
Gets the raw Javascript object representing this JSON value.
java.lang.Object getProperty(java.lang.String property)
If this JSON value is a JSON object, gets the raw Javascript object representing the value of a given property of this JSON object. If this JSON value is not a JSON object or if this JSON object has no property with the given name, then this method returns null
.
property
- org.jetbrains.dokka.NodeRenderContent@400fb0e4: The name of the property to retrieve of this JSON objectproperty
of this JSON object<T> T getValueAs(java.lang.Class<T> type)
Gets this JSON value as an object of a given type. If the conversion is not possible, this method returns null
.
type
- org.jetbrains.dokka.NodeRenderContent@4af5bc89: The Class
object associated to the
type
representing this JSON value<T> T getPropertyAs(java.lang.String property, java.lang.Class<T> type)
If this JSON value is a JSON object, gets the value of a given property as an object of a given type. If this JSON value is not a JSON object or if this JSON object has no property with the given name, then this method returns null
. If the conversion is not possible, this method returns null
.
property
- org.jetbrains.dokka.NodeRenderContent@741f3fde: The name of the property of this JSON object to converttype
- org.jetbrains.dokka.NodeRenderContent@6458b6df: The Class
object associated to the
type
representing the property named property
of this JSON object<T> java.util.List<T> getValueAsListOf(java.lang.Class<T> type)
Gets this JSON value as a list of elements of a given type. If the conversion is not possible (either the JSON value is not a list or one of its elements can't be converted to the given type), this method returns null
.
<T> java.util.List<T> getPropertyAsListOf(java.lang.String property, java.lang.Class<T> type)
If this JSON value is a JSON object, gets the value of a given property as a list of elements of a given type. If this JSON value is not a JSON object or if this JSON object has no property with the given name, then this method returns null
. If the conversion of the given property is not possible (see
), this method returns com.orange.webcom.sdk.JSONValue$getValueAsListOf(java.lang.Class)
null
.
property
- org.jetbrains.dokka.NodeRenderContent@37cb48b8: The name of the property of this JSON object to converttype
- org.jetbrains.dokka.NodeRenderContent@466d0e7f: The Class
object associated to the
typeList
of objects of class
representing the property named property
of this JSON objectcom.orange.webcom.sdk.JSONValue$getValueAsListOf(java.lang.Class)
<T> java.util.Map<java.lang.String,T> getValueAsMapOf(java.lang.Class<T> type)
Gets this JSON value as an associative map from String
to a given type. If the conversion is not possible (either the JSON value is not a map or one of its values can't be converted to the given type), this method returns null
.
<T> java.util.Map<java.lang.String,T> getPropertyAsMapOf(java.lang.String property, java.lang.Class<T> type)
If this JSON value is a JSON object, gets the value of a given property as an associative map from String
to a given type. If this JSON value is not a JSON object or if this JSON object has no property with the given name, then this method returns null
. If the conversion of the given property is not possible (see
), this method returns com.orange.webcom.sdk.JSONValue$getValueAsMapOf(java.lang.Class)
null
.
property
- org.jetbrains.dokka.NodeRenderContent@69d5acfa: The name of the property of this JSON object to converttype
- org.jetbrains.dokka.NodeRenderContent@53e1c265: The Class
object associated to the
typeMap
from String
to objects of class
representing the property named property
of this JSON objectcom.orange.webcom.sdk.JSONValue$getValueAsMapOf(java.lang.Class)