public class ClientJsonCodec extends Object
| Modifier and Type | Method and Description |
|---|---|
static StateNode |
decodeStateNode(StateTree tree,
elemental.json.JsonValue json)
Decodes a value as a
StateNode encoded on the server using
JsonCodec.encodeWithTypeInfo(Object) if it's possible. |
static Object |
decodeWithoutTypeInfo(elemental.json.JsonValue json)
Decodes a value encoded on the server using
JsonCodec.encodeWithoutTypeInfo(Object). |
static Object |
decodeWithTypeInfo(StateTree tree,
elemental.json.JsonValue json)
Decodes a value encoded on the server using
JsonCodec.encodeWithTypeInfo(Object). |
static elemental.json.JsonValue |
encodeWithoutTypeInfo(Object value)
Helper for encoding any "primitive" value that is directly supported in
JSON.
|
static JsArray<Object> |
jsonArrayAsJsArray(elemental.json.JsonArray jsonArray)
Converts a JSON array to a JS array.
|
public static StateNode decodeStateNode(StateTree tree, elemental.json.JsonValue json)
StateNode encoded on the server using
JsonCodec.encodeWithTypeInfo(Object) if it's possible. Otherwise
returns null.
It does the same as decodeWithTypeInfo(StateTree, JsonValue) for
the encoded json value if the encoded object is a StateNode
except it returns the node itself instead of a DOM element associated
with it.
tree - the state tree to use for resolving nodes and elementsjson - the JSON value to decodedecodeWithTypeInfo(StateTree, JsonValue)public static Object decodeWithTypeInfo(StateTree tree, elemental.json.JsonValue json)
JsonCodec.encodeWithTypeInfo(Object).tree - the state tree to use for resolving nodes and elementsjson - the JSON value to decodepublic static Object decodeWithoutTypeInfo(elemental.json.JsonValue json)
JsonCodec.encodeWithoutTypeInfo(Object). This is a no-op in
compiled JavaScript since the JSON representation can be used as-is, but
some special handling is needed for tests running in the JVM.json - the JSON value to convertpublic static elemental.json.JsonValue encodeWithoutTypeInfo(Object value)
String, Number,
Boolean, JsonValue. null is also supported.value - the value to encodepublic static JsArray<Object> jsonArrayAsJsArray(elemental.json.JsonArray jsonArray)
jsonArray - the JSON array to convertCopyright © 2000–2019 Vaadin Ltd. All rights reserved.