Package io.datarouter.gson.serializer
Class IntegerMappedEnumSerializer<T extends Enum<T>>
java.lang.Object
io.datarouter.gson.serializer.IntegerMappedEnumSerializer<T>
- All Implemented Interfaces:
com.google.gson.JsonDeserializer<T>,com.google.gson.JsonSerializer<T>
-
Method Summary
Modifier and TypeMethodDescriptiondeserialize(com.google.gson.JsonElement json, Type typeOfT, com.google.gson.JsonDeserializationContext context) static final <T extends Enum<T>>
IntegerMappedEnumSerializer<T>When deserializing, return the replacement if the value is not found.static final <T extends Enum<T>>
IntegerMappedEnumSerializer<T>optionalWithLogging(io.datarouter.enums.MappedEnum<T, Integer> mappedEnum, T replacement) When deserializing, return the replacement if the value is not found.static final <T extends Enum<T>>
IntegerMappedEnumSerializer<T>When deserializing, throw an exception if the value is not found.com.google.gson.JsonElement
-
Method Details
-
required
public static final <T extends Enum<T>> IntegerMappedEnumSerializer<T> required(io.datarouter.enums.MappedEnum<T, Integer> mappedEnum) When deserializing, throw an exception if the value is not found. -
optional
public static final <T extends Enum<T>> IntegerMappedEnumSerializer<T> optional(io.datarouter.enums.MappedEnum<T, Integer> mappedEnum, T replacement) When deserializing, return the replacement if the value is not found. -
optionalWithLogging
public static final <T extends Enum<T>> IntegerMappedEnumSerializer<T> optionalWithLogging(io.datarouter.enums.MappedEnum<T, Integer> mappedEnum, T replacement) When deserializing, return the replacement if the value is not found. Log the replacement. -
serialize
-
deserialize
-