com.vaadin.terminal.gwt.server
Class JsonCodec

java.lang.Object
  extended by com.vaadin.terminal.gwt.server.JsonCodec
All Implemented Interfaces:
Serializable

public class JsonCodec
extends Object
implements 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

Constructor Summary
JsonCodec()
           
 
Method Summary
static Object decodeCustomType(Type targetType, Object value, ConnectorTracker connectorTracker)
           
static Object decodeInternalOrCustomType(Type targetType, Object value, ConnectorTracker connectorTracker)
           
static Object decodeInternalType(Type targetType, boolean restrictToInternalTypes, Object encodedJsonValue, ConnectorTracker connectorTracker)
          Decodes a value that is of an internal type.
static Object encode(Object value, Object referenceValue, Type valueType, ConnectorTracker connectorTracker)
           
static boolean isInternalTransportType(String transportType)
           
static boolean isInternalType(Type type)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JsonCodec

public JsonCodec()
Method Detail

isInternalTransportType

public static boolean isInternalTransportType(String transportType)

isInternalType

public static boolean isInternalType(Type type)

decodeInternalOrCustomType

public static Object decodeInternalOrCustomType(Type targetType,
                                                Object value,
                                                ConnectorTracker connectorTracker)
                                         throws JSONException
Throws:
JSONException

decodeCustomType

public static Object decodeCustomType(Type targetType,
                                      Object value,
                                      ConnectorTracker connectorTracker)
                               throws JSONException
Throws:
JSONException

decodeInternalType

public static Object decodeInternalType(Type targetType,
                                        boolean restrictToInternalTypes,
                                        Object encodedJsonValue,
                                        ConnectorTracker connectorTracker)
                                 throws 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 method
valueAndType - The encoded value and type array
application - A reference to the application
enforceGenericsInCollections - true if generics should be enforce, false to only allow internal types in collections
Returns:
Throws:
JSONException

encode

public static Object encode(Object value,
                            Object referenceValue,
                            Type valueType,
                            ConnectorTracker connectorTracker)
                     throws JSONException
Throws:
JSONException


Copyright © 2000-2011 Vaadin Ltd. All Rights Reserved.