public final class TreeTypeAdapter<T> extends TypeAdapter<T>
| Constructor and Description |
|---|
TreeTypeAdapter(JsonSerializer<T> serializer,
JsonDeserializer<T> deserializer,
Gson gson,
TypeToken<T> typeToken,
TypeAdapterFactory skipPast) |
| Modifier and Type | Method and Description |
|---|---|
static TypeAdapterFactory |
newFactory(TypeToken<?> exactType,
java.lang.Object typeAdapter)
Returns a new factory that will match each type against
exactType. |
static TypeAdapterFactory |
newFactoryWithMatchRawType(TypeToken<?> exactType,
java.lang.Object typeAdapter)
Returns a new factory that will match each type and its raw type against
exactType. |
static TypeAdapterFactory |
newTypeHierarchyFactory(java.lang.Class<?> hierarchyType,
java.lang.Object typeAdapter)
Returns a new factory that will match each type's raw type for assignability
to
hierarchyType. |
T |
read(JsonReader in)
Reads one JSON value (an array, object, string, number, boolean or null)
and converts it to a Java object.
|
void |
write(JsonWriter out,
T value)
Writes one JSON value (an array, object, string, number, boolean or null)
for
value. |
fromJson, fromJson, fromJsonTree, nullSafe, toJson, toJson, toJsonTreepublic TreeTypeAdapter(JsonSerializer<T> serializer, JsonDeserializer<T> deserializer, Gson gson, TypeToken<T> typeToken, TypeAdapterFactory skipPast)
public T read(JsonReader in) throws java.io.IOException
TypeAdapterread in class TypeAdapter<T>java.io.IOExceptionpublic void write(JsonWriter out, T value) throws java.io.IOException
TypeAdaptervalue.write in class TypeAdapter<T>value - the Java object to write. May be null.java.io.IOExceptionpublic static TypeAdapterFactory newFactory(TypeToken<?> exactType, java.lang.Object typeAdapter)
exactType.public static TypeAdapterFactory newFactoryWithMatchRawType(TypeToken<?> exactType, java.lang.Object typeAdapter)
exactType.public static TypeAdapterFactory newTypeHierarchyFactory(java.lang.Class<?> hierarchyType, java.lang.Object typeAdapter)
hierarchyType.