private final class TreeTypeAdapter.GsonContextImpl extends java.lang.Object implements JsonSerializationContext, JsonDeserializationContext
Modifier | Constructor and Description |
---|---|
private |
GsonContextImpl() |
Modifier and Type | Method and Description |
---|---|
<R> R |
deserialize(JsonElement json,
java.lang.reflect.Type typeOfT)
Invokes default deserialization on the specified object.
|
JsonElement |
serialize(java.lang.Object src)
Invokes default serialization on the specified object.
|
JsonElement |
serialize(java.lang.Object src,
java.lang.reflect.Type typeOfSrc)
Invokes default serialization on the specified object passing the specific type information.
|
public JsonElement serialize(java.lang.Object src)
JsonSerializationContext
serialize
in interface JsonSerializationContext
src
- the object that needs to be serialized.JsonElement
s corresponding to the serialized form of src
.public JsonElement serialize(java.lang.Object src, java.lang.reflect.Type typeOfSrc)
JsonSerializationContext
JsonSerializer.serialize(Object, Type, JsonSerializationContext)
method. Doing
so will result in an infinite loop since Gson will in-turn call the custom serializer again.serialize
in interface JsonSerializationContext
src
- the object that needs to be serialized.typeOfSrc
- the actual genericized type of src object.JsonElement
s corresponding to the serialized form of src
.public <R> R deserialize(JsonElement json, java.lang.reflect.Type typeOfT) throws JsonParseException
JsonDeserializationContext
JsonDeserializer.deserialize(JsonElement, Type, JsonDeserializationContext)
method. Doing
so will result in an infinite loop since Gson will in-turn call the custom deserializer again.deserialize
in interface JsonDeserializationContext
R
- The type of the deserialized object.json
- the parse tree.typeOfT
- type of the expected return value.JsonParseException
- if the parse tree does not contain expected data.