Package com.vaadin.server.communication
Interface JSONSerializer<T>
-
- All Known Implementing Classes:
DateSerializer
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, ConnectorTracker)
anddeserialize(Type, JsonValue, ConnectorTracker)
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.This is the server side interface, see com.vaadin.client.communication.JSONSerializer for the client side interface.
- Since:
- 7.2
- Author:
- Vaadin Ltd
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description T
deserialize(Type type, JsonValue jsonValue, ConnectorTracker connectorTracker)
Creates and deserializes an object received from the client.JsonValue
serialize(T value, ConnectorTracker connectorTracker)
Serialize the given object into JSON.
-
-
-
Method Detail
-
deserialize
T deserialize(Type type, JsonValue jsonValue, ConnectorTracker connectorTracker)
Creates and deserializes an object received from the client. Must be compatible withserialize(Object, ConnectorTracker)
and also with the client side com.vaadin.client.communication.JSONSerializer.- Parameters:
type
- The expected return typejsonValue
- the value from the JSONconnectorTracker
- the connector tracker instance for the UI- Returns:
- A deserialized object
-
serialize
JsonValue serialize(T value, ConnectorTracker connectorTracker)
Serialize the given object into JSON. Must be compatible withdeserialize(Type, JsonValue, ConnectorTracker)
and the client side com.vaadin.client.communication.JSONSerializer- Parameters:
value
- The object to serializeconnectorTracker
- The connector tracker instance for the UI- Returns:
- A JSON serialized version of the object
-
-