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 Summary
FieldsModifier and TypeFieldDescriptionprivate final ThreadLocal<GraphAdapterBuilder.Graph>
private final Map<Type,
InstanceCreator<?>> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> TypeAdapter<T>
Returns a type adapter fortype
, or null if this factory doesn't supporttype
.createInstance
(Type type) Hook for the graph adapter to get a reference to a deserialized value before that value is fully populated.
-
Field Details
-
instanceCreators
-
graphThreadLocal
-
-
Constructor Details
-
Factory
Factory(Map<Type, InstanceCreator<?>> instanceCreators)
-
-
Method Details
-
create
Description copied from interface:TypeAdapterFactory
Returns a type adapter fortype
, or null if this factory doesn't supporttype
.- Specified by:
create
in interfaceTypeAdapterFactory
-
createInstance
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 interfaceInstanceCreator
- Parameters:
type
- the parameterized T represented as aType
.- Returns:
- a default object instance of type T.
-