Class AutoValueTypeAdapterFactory

  • All Implemented Interfaces:
    com.google.gson.TypeAdapterFactory

    public final class AutoValueTypeAdapterFactory
    extends java.lang.Object
    implements com.google.gson.TypeAdapterFactory
    A TypeAdapterFactory that attempts to delegate any serialization/deserialization of an AutoValue class to the adapter that is registered for the base class.

    For example, this allows use of JsonAdapter on the base AutoValue class. Proper serialization will still occur according to that JsonAdapter when the class is passed through Gson. Otherwise, Gson would always use default serialization on AutoValue classes, because technically, the generated class has no custom serializer.

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <T> com.google.gson.TypeAdapter<T> create​(com.google.gson.Gson gson, com.google.gson.reflect.TypeToken<T> typeToken)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AutoValueTypeAdapterFactory

        public AutoValueTypeAdapterFactory()
    • Method Detail

      • create

        public <T> com.google.gson.TypeAdapter<T> create​(com.google.gson.Gson gson,
                                                         com.google.gson.reflect.TypeToken<T> typeToken)
        Specified by:
        create in interface com.google.gson.TypeAdapterFactory