com.vaadin.terminal.gwt.client.communication
Interface JSONSerializer<T>

All Known Implementing Classes:
URLReference_Serializer

public interface JSONSerializer<T>

Implementors of this interface knows how to serialize an Object of a given type to JSON and how to deserialize the JSON back into an object. The #serialize(Object, ConnectorMap) and #deserialize(JSONObject, ConnectorMap) methods must be symmetric so they can be chained and produce the original result (or an equal result). Each JSONSerializer implementation can handle an object of a single type - see SerializerMap.

Since:
7.0

Method Summary
 T deserialize(com.google.gwt.json.client.JSONObject jsonValue, ConnectorMap idMapper, ApplicationConnection connection)
          Creates and deserializes an object received from the server.
 com.google.gwt.json.client.JSONObject serialize(T value, ConnectorMap idMapper, ApplicationConnection connection)
          Serialize the given object into JSON.
 

Method Detail

deserialize

T deserialize(com.google.gwt.json.client.JSONObject jsonValue,
              ConnectorMap idMapper,
              ApplicationConnection connection)
Creates and deserializes an object received from the server. Must be compatible with #serialize(Object, ConnectorMap) and also with the server side JsonCodec#encode(Object, com.vaadin.terminal.gwt.server.PaintableIdMapper) .

Parameters:
jsonValue - JSON map from property name to property value
idMapper - mapper from paintable id to paintable, used to decode references to paintables
Returns:
A deserialized object

serialize

com.google.gwt.json.client.JSONObject serialize(T value,
                                                ConnectorMap idMapper,
                                                ApplicationConnection connection)
Serialize the given object into JSON. Must be compatible with #deserialize(JSONObject, ConnectorMap) and also with the server side JsonCodec#decode(com.vaadin.external.json.JSONArray, com.vaadin.terminal.gwt.server.PaintableIdMapper)

Parameters:
value - The object to serialize
idMapper - mapper from paintable id to paintable, used to decode references to paintables
Returns:
A JSON serialized version of the object


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