Package ai.nextbillion.maps.internal
Class SafeEnumAdapter<E extends java.lang.Enum<E>>
java.lang.Object
com.google.gson.TypeAdapter<E>
ai.nextbillion.maps.internal.SafeEnumAdapter<E>
- Type Parameters:
E- the enum type to map values to.
public class SafeEnumAdapter<E extends java.lang.Enum<E>>
extends com.google.gson.TypeAdapter<E>
A
TypeAdapter that maps case-insensitive values to an enum type. If the
value is not found, an UNKNOWN value is returned, and logged. This allows the server to return
values this client doesn't yet know about.-
Constructor Summary
Constructors Constructor Description SafeEnumAdapter(E unknownValue) -
Method Summary
-
Constructor Details
-
SafeEnumAdapter
- Parameters:
unknownValue- the value to return if the value cannot be found.
-
-
Method Details