
static class GraphAdapterBuilder.Factory extends Object implements TypeAdapterFactory, InstanceCreator
| Modifier and Type | Field and Description |
|---|---|
private ThreadLocal<GraphAdapterBuilder.Graph> |
graphThreadLocal |
private Map<Type,InstanceCreator<?>> |
instanceCreators |
| Constructor and Description |
|---|
Factory(Map<Type,InstanceCreator<?>> instanceCreators) |
| Modifier and Type | Method and Description |
|---|---|
<T> TypeAdapter<T> |
create(Gson gson,
TypeToken<T> type) |
Object |
createInstance(Type type)
Hook for the graph adapter to get a reference to a deserialized value
before that value is fully populated.
|
private final Map<Type,InstanceCreator<?>> instanceCreators
private final ThreadLocal<GraphAdapterBuilder.Graph> graphThreadLocal
Factory(Map<Type,InstanceCreator<?>> instanceCreators)
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type)
create in interface TypeAdapterFactorypublic Object createInstance(Type type)
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.
createInstance in interface InstanceCreator