Class DynamicModelTypeAdapterFactory.Adapter<T>

  • Enclosing class:
    DynamicModelTypeAdapterFactory

    public static class DynamicModelTypeAdapterFactory.Adapter<T>
    extends com.google.gson.TypeAdapter<T>
    An adapter for serializing/deserializing instances of type T, where T represents a generated dynamic model class which is a subclass of DynamicModel. Subclasses of DynamicModel will have zero or more explicitly-defined fields plus a map to store additional (arbitrary) properties.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.google.gson.reflect.TypeToken<?> getMapValueType​(T instance)
      Returns a TypeToken which represents the type of values stored in the DynamicModel's inherited map.
      T read​(com.google.gson.stream.JsonReader in)  
      void write​(com.google.gson.stream.JsonWriter out, T value)  
      • Methods inherited from class com.google.gson.TypeAdapter

        fromJson, fromJson, fromJsonTree, nullSafe, toJson, toJson, toJsonTree
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • write

        public void write​(com.google.gson.stream.JsonWriter out,
                          T value)
                   throws java.io.IOException
        Specified by:
        write in class com.google.gson.TypeAdapter<T>
        Throws:
        java.io.IOException
      • read

        public T read​(com.google.gson.stream.JsonReader in)
               throws java.io.IOException
        Specified by:
        read in class com.google.gson.TypeAdapter<T>
        Throws:
        java.io.IOException
      • getMapValueType

        public com.google.gson.reflect.TypeToken<?> getMapValueType​(T instance)
        Returns a TypeToken which represents the type of values stored in the DynamicModel's inherited map.
        Parameters:
        instance - the DynamicModel instance from which we'll retrieve the TypeToken
        Returns:
        the TypeToken representing the map value type