Package elemental.json
Interface JsonValue
-
- All Superinterfaces:
Serializable
- All Known Subinterfaces:
JsonArray
,JsonBoolean
,JsonNull
,JsonNumber
,JsonObject
,JsonString
- All Known Implementing Classes:
JreJsonArray
,JreJsonBoolean
,JreJsonNull
,JreJsonNumber
,JreJsonObject
,JreJsonString
,JreJsonValue
public interface JsonValue extends Serializable
Base interface for all Json values.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
asBoolean()
Coerces underlying value to boolean according to the rules of Javascript coercion.double
asNumber()
Coerces the underlying value to a number according to the rules of Javascript coercion.String
asString()
Coerces the underlying value to a String according to the rules of JavaScript coercion.JsonType
getType()
Returns an enumeration representing the fundamental JSON type.boolean
jsEquals(JsonValue value)
Equivalent of Javascript '==' operator comparison between two values.String
toJson()
Returns a serialized JSON string representing this value.Object
toNative()
If used in a GWT context (dev or prod mode), converts the object to a native JavaScriptObject suitable for passing to JSNI methods.
-
-
-
Method Detail
-
asBoolean
boolean asBoolean()
Coerces underlying value to boolean according to the rules of Javascript coercion.
-
asNumber
double asNumber()
Coerces the underlying value to a number according to the rules of Javascript coercion.
-
asString
String asString()
Coerces the underlying value to a String according to the rules of JavaScript coercion.
-
getType
JsonType getType()
Returns an enumeration representing the fundamental JSON type.
-
toJson
String toJson()
Returns a serialized JSON string representing this value.- Returns:
-
jsEquals
boolean jsEquals(JsonValue value)
Equivalent of Javascript '==' operator comparison between two values.
-
toNative
Object toNative()
If used in a GWT context (dev or prod mode), converts the object to a native JavaScriptObject suitable for passing to JSNI methods. Otherwise, returns the current object in other contexts, such as server-side use.
-
-