Interface JsonAdvancedTypeAdapter<T>

  • All Known Implementing Classes:
    OptionalTypeAdapter

    public interface JsonAdvancedTypeAdapter<T>
    Advanced variant of JsonTypeAdapter.
    Can be used to write polymorphic/generic type adapters.

    Provides additional argument: Type typeOfT — a runtime type of a serialized/deserialized object
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      T fromJson​(com.google.gson.JsonElement json, java.lang.reflect.Type typeOfT, com.google.gson.JsonDeserializationContext context)  
      java.lang.Class<T> getTypeSuperclass()  
      com.google.gson.JsonElement toJson​(T sourceValue, java.lang.reflect.Type typeOfT, com.google.gson.JsonSerializationContext context)  
    • Method Detail

      • fromJson

        T fromJson​(com.google.gson.JsonElement json,
                   java.lang.reflect.Type typeOfT,
                   com.google.gson.JsonDeserializationContext context)
      • toJson

        com.google.gson.JsonElement toJson​(T sourceValue,
                                           java.lang.reflect.Type typeOfT,
                                           com.google.gson.JsonSerializationContext context)
      • getTypeSuperclass

        java.lang.Class<T> getTypeSuperclass()