com.vaadin.server
Class JsonCodec
java.lang.Object
com.vaadin.server.JsonCodec
- All Implemented Interfaces:
- java.io.Serializable
public class JsonCodec
- extends java.lang.Object
- implements java.io.Serializable
Decoder for converting RPC parameters and other values from JSON in transfer
between the client and the server and vice versa.
- Since:
- 7.0
- See Also:
- Serialized Form
Method Summary |
static java.lang.Object |
decodeCustomType(java.lang.reflect.Type targetType,
java.lang.Object value,
ConnectorTracker connectorTracker)
|
static java.lang.Object |
decodeInternalOrCustomType(java.lang.reflect.Type targetType,
java.lang.Object value,
ConnectorTracker connectorTracker)
|
static java.lang.Object |
decodeInternalType(java.lang.reflect.Type targetType,
boolean restrictToInternalTypes,
java.lang.Object encodedJsonValue,
ConnectorTracker connectorTracker)
Decodes a value that is of an internal type. |
static EncodeResult |
encode(java.lang.Object value,
java.lang.Object diffState,
java.lang.reflect.Type valueType,
ConnectorTracker connectorTracker)
|
static java.util.Collection<JsonCodec.BeanProperty> |
getProperties(java.lang.Class<?> type)
|
static boolean |
isInternalTransportType(java.lang.String transportType)
|
static boolean |
isInternalType(java.lang.reflect.Type type)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
JsonCodec
public JsonCodec()
isInternalTransportType
public static boolean isInternalTransportType(java.lang.String transportType)
isInternalType
public static boolean isInternalType(java.lang.reflect.Type type)
decodeInternalOrCustomType
public static java.lang.Object decodeInternalOrCustomType(java.lang.reflect.Type targetType,
java.lang.Object value,
ConnectorTracker connectorTracker)
throws org.json.JSONException
- Throws:
org.json.JSONException
decodeCustomType
public static java.lang.Object decodeCustomType(java.lang.reflect.Type targetType,
java.lang.Object value,
ConnectorTracker connectorTracker)
throws org.json.JSONException
- Throws:
org.json.JSONException
decodeInternalType
public static java.lang.Object decodeInternalType(java.lang.reflect.Type targetType,
boolean restrictToInternalTypes,
java.lang.Object encodedJsonValue,
ConnectorTracker connectorTracker)
throws org.json.JSONException
- Decodes a value that is of an internal type.
Ensures the encoded value is of the same type as target type.
Allows restricting collections so that they must be declared using
generics. If this is used then all objects in the collection are encoded
using the declared type. Otherwise only internal types are allowed in
collections.
- Parameters:
targetType
- The type that should be returned by this methodvalueAndType
- The encoded value and type arrayapplication
- A reference to the applicationenforceGenericsInCollections
- true if generics should be enforce, false to only allow
internal types in collections
- Returns:
-
- Throws:
org.json.JSONException
encode
public static EncodeResult encode(java.lang.Object value,
java.lang.Object diffState,
java.lang.reflect.Type valueType,
ConnectorTracker connectorTracker)
throws org.json.JSONException
- Throws:
org.json.JSONException
getProperties
public static java.util.Collection<JsonCodec.BeanProperty> getProperties(java.lang.Class<?> type)
throws java.beans.IntrospectionException
- Throws:
java.beans.IntrospectionException
Copyright © 2000-2014 Vaadin Ltd. All Rights Reserved.