public class OptionalAdapter extends java.lang.Object implements com.solidfire.gson.JsonSerializer<Optional<?>>, com.solidfire.gson.JsonDeserializer<Optional<?>>, com.solidfire.gson.InstanceCreator<Optional<?>>
Constructor and Description |
---|
OptionalAdapter() |
Modifier and Type | Method and Description |
---|---|
Optional<?> |
createInstance(java.lang.reflect.Type type) |
Optional<?> |
deserialize(com.solidfire.gson.JsonElement json,
java.lang.reflect.Type typeOfT,
com.solidfire.gson.JsonDeserializationContext context)
Deserializes an Optional object.
|
com.solidfire.gson.JsonElement |
serialize(Optional<?> optional,
java.lang.reflect.Type type,
com.solidfire.gson.JsonSerializationContext context)
Serializes an Optional object.
|
static java.lang.Class |
serializingClass()
Gets the Class that this adapter serializes.
|
public static java.lang.Class serializingClass()
public Optional<?> createInstance(java.lang.reflect.Type type)
createInstance
in interface com.solidfire.gson.InstanceCreator<Optional<?>>
public com.solidfire.gson.JsonElement serialize(Optional<?> optional, java.lang.reflect.Type type, com.solidfire.gson.JsonSerializationContext context)
serialize
in interface com.solidfire.gson.JsonSerializer<Optional<?>>
optional
- the value to serialize.type
- the type of the source object.context
- Context used for serialization.public Optional<?> deserialize(com.solidfire.gson.JsonElement json, java.lang.reflect.Type typeOfT, com.solidfire.gson.JsonDeserializationContext context)
deserialize
in interface com.solidfire.gson.JsonDeserializer<Optional<?>>
json
- the element to deserialize.typeOfT
- type of the expected return value.context
- Context used for deserialization.