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

All Known Subinterfaces:
DiffJSONSerializer<T>
All Known Implementing Classes:
Date_Serializer, 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, ApplicationConnection) and deserialize(Type, JsonValue, ApplicationConnection) 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 Type.findSerializer().

This is the client side interface, see com.vaadin.server.communication.JSONSerializer for the server side interface.

Since:
7.0

Method Summary
 T deserialize(Type type, elemental.json.JsonValue jsonValue, ApplicationConnection connection)
          Creates and deserializes an object received from the server.
 elemental.json.JsonValue serialize(T value, ApplicationConnection connection)
          Serialize the given object into JSON.
 

Method Detail

deserialize

T deserialize(Type type,
              elemental.json.JsonValue jsonValue,
              ApplicationConnection connection)
Creates and deserializes an object received from the server. Must be compatible with serialize(Object, ApplicationConnection) and also with the server side JsonCodec.encode method.

Parameters:
type - the type to deserialize
jsonValue - JSON map from property name to property value
connection - the application connection providing the context
Returns:
A deserialized object

serialize

elemental.json.JsonValue serialize(T value,
                                   ApplicationConnection connection)
Serialize the given object into JSON. Must be compatible with deserialize(Type, JsonValue, ApplicationConnection) and also with the server side JsonCodec.decodeCustomType method.

Parameters:
value - The object to serialize
connection - the application connection providing the context
Returns:
A JSON serialized version of the object


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