- All Implemented Interfaces:
com.google.gson.JsonDeserializer<T>, com.google.gson.JsonSerializer<T>
public class EnumTypeAdapter<T extends Enum<?>>
extends Object
implements com.google.gson.JsonSerializer<T>, com.google.gson.JsonDeserializer<T>
-
Constructor Summary
Constructors
-
Method Summary
deserialize(com.google.gson.JsonElement json,
Type type,
com.google.gson.JsonDeserializationContext context)
com.google.gson.JsonElement
serialize(T o,
Type type,
com.google.gson.JsonSerializationContext jsonSerializationContext)
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
EnumTypeAdapter
public EnumTypeAdapter(Class<?> enumType)
-
Method Details
-
-
serialize
public com.google.gson.JsonElement serialize(T o,
Type type,
com.google.gson.JsonSerializationContext jsonSerializationContext)
- Specified by:
serialize in interface com.google.gson.JsonSerializer<T extends Enum<?>>
-
deserialize
public T deserialize(com.google.gson.JsonElement json,
Type type,
com.google.gson.JsonDeserializationContext context)
throws com.google.gson.JsonParseException
- Specified by:
deserialize in interface com.google.gson.JsonDeserializer<T extends Enum<?>>
- Throws:
com.google.gson.JsonParseException