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

All Known Subinterfaces:
DiffJSONSerializer<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(Type type, com.google.gwt.json.client.JSONValue jsonValue, ApplicationConnection connection)
          Creates and deserializes an object received from the server.
 com.google.gwt.json.client.JSONValue serialize(T value, ApplicationConnection connection)
          Serialize the given object into JSON.
 

Method Detail

deserialize

T deserialize(Type type,
              com.google.gwt.json.client.JSONValue jsonValue,
              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
Returns:
A deserialized object

serialize

com.google.gwt.json.client.JSONValue serialize(T value,
                                               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
Returns:
A JSON serialized version of the object


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