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) and deserialize(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 Detail

      • deserialize

        T deserialize​(Type type,
                      JsonValue jsonValue,
                      ConnectorTracker connectorTracker)
        Creates and deserializes an object received from the client. Must be compatible with serialize(Object, ConnectorTracker) and also with the client side com.vaadin.client.communication.JSONSerializer.
        Parameters:
        type - The expected return type
        jsonValue - the value from the JSON
        connectorTracker - 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 with deserialize(Type, JsonValue, ConnectorTracker) and the client side com.vaadin.client.communication.JSONSerializer
        Parameters:
        value - The object to serialize
        connectorTracker - The connector tracker instance for the UI
        Returns:
        A JSON serialized version of the object