Class JsonDecoder


  • public class JsonDecoder
    extends Object
    Client side decoder for decodeing shared state and other values from JSON received from the server. Currently, basic data types as well as Map, String[] and Object[] are supported, where maps and Object[] can contain other supported data types. TODO extensible type support
    Since:
    7.0
    • Constructor Detail

      • JsonDecoder

        public JsonDecoder()
    • Method Detail

      • decodeValue

        public static Object decodeValue​(Type type,
                                         JsonValue jsonValue,
                                         Object target,
                                         ApplicationConnection connection)
        Decode a JSON array with two elements (type and value) into a client-side type, recursively if necessary.
        Parameters:
        jsonValue - JSON value with encoded data
        connection - reference to the current ApplicationConnection
        Returns:
        decoded value (does not contain JSON types)
      • obj2jso

        public static <T extends JsonValue> T obj2jso​(Object object)
        Called by generated deserialization code to treat a generic object as a JsonValue. This is needed because GWT refuses to directly cast String typed as Object into a JSO.