Class GraphAdapterBuilder.Factory

java.lang.Object
com.google.gson.graph.GraphAdapterBuilder.Factory
All Implemented Interfaces:
InstanceCreator, TypeAdapterFactory
Enclosing class:
GraphAdapterBuilder

static class GraphAdapterBuilder.Factory extends Object implements TypeAdapterFactory, InstanceCreator
  • Field Details

  • Constructor Details

  • Method Details

    • create

      public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type)
      Description copied from interface: TypeAdapterFactory
      Returns a type adapter for type, or null if this factory doesn't support type.
      Specified by:
      create in interface TypeAdapterFactory
    • createInstance

      public Object createInstance(Type type)
      Hook for the graph adapter to get a reference to a deserialized value before that value is fully populated. This is useful to deserialize values that directly or indirectly reference themselves: we can hand out an instance before read() returns.

      Gson should only ever call this method when we're expecting it to; that is only when we've called back into Gson to deserialize a tree.

      Specified by:
      createInstance in interface InstanceCreator
      Parameters:
      type - the parameterized T represented as a Type.
      Returns:
      a default object instance of type T.