Package software.amazon.awssdk.iot
Class EnumSerializer<E>
- java.lang.Object
-
- software.amazon.awssdk.iot.EnumSerializer<E>
-
- Type Parameters:
E
- the enumeration type the serializer should work with
- All Implemented Interfaces:
com.google.gson.JsonDeserializer<E>
,com.google.gson.JsonSerializer<E>
public class EnumSerializer<E> extends Object implements com.google.gson.JsonSerializer<E>, com.google.gson.JsonDeserializer<E>
Custom JSON serializer for enumerated types within IoT service models
-
-
Constructor Summary
Constructors Constructor Description EnumSerializer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description E
deserialize(com.google.gson.JsonElement json, Type typeOfEnum, com.google.gson.JsonDeserializationContext context)
Deserializes the JsonElement to an enumcom.google.gson.JsonElement
serialize(E enumValue, Type typeOfEnum, com.google.gson.JsonSerializationContext context)
Serializes the given enum to a JsonElement
-
-
-
Method Detail
-
serialize
public com.google.gson.JsonElement serialize(E enumValue, Type typeOfEnum, com.google.gson.JsonSerializationContext context)
Serializes the given enum to a JsonElement- Specified by:
serialize
in interfacecom.google.gson.JsonSerializer<E>
- Parameters:
enumValue
- The enum to converttypeOfEnum
- The enum to convert typecontext
- The JsonSerializationContext to use- Returns:
- The enum as a JsonElement
-
deserialize
public E deserialize(com.google.gson.JsonElement json, Type typeOfEnum, com.google.gson.JsonDeserializationContext context) throws com.google.gson.JsonParseException
Deserializes the JsonElement to an enum- Specified by:
deserialize
in interfacecom.google.gson.JsonDeserializer<E>
- Parameters:
json
- The json to converttypeOfEnum
- The type of enum to convert tocontext
- The JsonDeserializationContext to use- Returns:
- The enum from the JsonElement data
- Throws:
com.google.gson.JsonParseException
-
-