Class EnumResolver
- java.lang.Object
-
- com.fasterxml.jackson.databind.util.EnumResolver
-
- All Implemented Interfaces:
java.io.Serializable
public class EnumResolver extends java.lang.Object implements java.io.Serializable
Helper class used to resolve String values (either JSON Object field names or regular String values) into Java Enum instances.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static EnumResolver
constructFor(DeserializationConfig config, java.lang.Class<?> enumCls)
Factory method for constructing resolver that maps from Enum.name() into Enum value.static EnumResolver
constructFor(java.lang.Class<java.lang.Enum<?>> enumCls, AnnotationIntrospector ai)
Deprecated.Since 2.12CompactStringObjectMap
constructLookup()
static EnumResolver
constructUnsafe(java.lang.Class<?> rawEnumCls, AnnotationIntrospector ai)
Deprecated.Since 2.12static EnumResolver
constructUnsafeUsingMethod(java.lang.Class<?> rawEnumCls, AnnotatedMember accessor, AnnotationIntrospector ai)
Deprecated.Since 2.12static EnumResolver
constructUnsafeUsingToString(java.lang.Class<?> rawEnumCls, AnnotationIntrospector ai)
Deprecated.Since 2.12static EnumResolver
constructUsingMethod(DeserializationConfig config, java.lang.Class<?> enumCls, AnnotatedMember accessor)
Method used when actual String serialization is indicated using @JsonValue on a method in Enum class.static EnumResolver
constructUsingMethod(java.lang.Class<java.lang.Enum<?>> enumCls, AnnotatedMember accessor, AnnotationIntrospector ai)
Deprecated.Since 2.12static EnumResolver
constructUsingToString(DeserializationConfig config, java.lang.Class<?> enumCls)
Factory method for constructing resolver that maps from Enum.toString() into Enum valuestatic EnumResolver
constructUsingToString(java.lang.Class<java.lang.Enum<?>> enumCls)
Deprecated.Since 2.8 (remove from 2.13 or later)static EnumResolver
constructUsingToString(java.lang.Class<java.lang.Enum<?>> enumCls, AnnotationIntrospector ai)
Deprecated.Since 2.12java.lang.Enum<?>
findEnum(java.lang.String key)
java.lang.Enum<?>
getDefaultValue()
java.lang.Enum<?>
getEnum(int index)
java.lang.Class<java.lang.Enum<?>>
getEnumClass()
java.util.Collection<java.lang.String>
getEnumIds()
java.util.List<java.lang.Enum<?>>
getEnums()
java.lang.Enum<?>[]
getRawEnums()
boolean
isFromIntValue()
Accessor for checking if we have a special case in which value to map is from@JsonValue
annotated accessor with integral type: this matters for cases where incoming content value is of integral type and should be mapped to specific value and NOT toEnum.index()
.int
lastValidIndex()
-
-
-
Method Detail
-
constructFor
public static EnumResolver constructFor(DeserializationConfig config, java.lang.Class<?> enumCls)
Factory method for constructing resolver that maps from Enum.name() into Enum value.- Since:
- 2.12
-
constructUsingToString
public static EnumResolver constructUsingToString(DeserializationConfig config, java.lang.Class<?> enumCls)
Factory method for constructing resolver that maps from Enum.toString() into Enum value- Since:
- 2.12
-
constructUsingMethod
public static EnumResolver constructUsingMethod(DeserializationConfig config, java.lang.Class<?> enumCls, AnnotatedMember accessor)
Method used when actual String serialization is indicated using @JsonValue on a method in Enum class.- Since:
- 2.12
-
constructLookup
public CompactStringObjectMap constructLookup()
-
constructFor
@Deprecated public static EnumResolver constructFor(java.lang.Class<java.lang.Enum<?>> enumCls, AnnotationIntrospector ai)
Deprecated.Since 2.12
-
constructUnsafe
@Deprecated public static EnumResolver constructUnsafe(java.lang.Class<?> rawEnumCls, AnnotationIntrospector ai)
Deprecated.Since 2.12
-
constructUsingToString
@Deprecated public static EnumResolver constructUsingToString(java.lang.Class<java.lang.Enum<?>> enumCls, AnnotationIntrospector ai)
Deprecated.Since 2.12
-
constructUnsafeUsingToString
@Deprecated public static EnumResolver constructUnsafeUsingToString(java.lang.Class<?> rawEnumCls, AnnotationIntrospector ai)
Deprecated.Since 2.12- Since:
- 2.8
-
constructUsingToString
@Deprecated public static EnumResolver constructUsingToString(java.lang.Class<java.lang.Enum<?>> enumCls)
Deprecated.Since 2.8 (remove from 2.13 or later)
-
constructUsingMethod
@Deprecated public static EnumResolver constructUsingMethod(java.lang.Class<java.lang.Enum<?>> enumCls, AnnotatedMember accessor, AnnotationIntrospector ai)
Deprecated.Since 2.12
-
constructUnsafeUsingMethod
@Deprecated public static EnumResolver constructUnsafeUsingMethod(java.lang.Class<?> rawEnumCls, AnnotatedMember accessor, AnnotationIntrospector ai)
Deprecated.Since 2.12- Since:
- 2.9
-
findEnum
public java.lang.Enum<?> findEnum(java.lang.String key)
-
getEnum
public java.lang.Enum<?> getEnum(int index)
-
getDefaultValue
public java.lang.Enum<?> getDefaultValue()
-
getRawEnums
public java.lang.Enum<?>[] getRawEnums()
-
getEnums
public java.util.List<java.lang.Enum<?>> getEnums()
-
getEnumIds
public java.util.Collection<java.lang.String> getEnumIds()
- Since:
- 2.7.3
-
getEnumClass
public java.lang.Class<java.lang.Enum<?>> getEnumClass()
-
lastValidIndex
public int lastValidIndex()
-
isFromIntValue
public boolean isFromIntValue()
Accessor for checking if we have a special case in which value to map is from@JsonValue
annotated accessor with integral type: this matters for cases where incoming content value is of integral type and should be mapped to specific value and NOT toEnum.index()
.- Since:
- 2.13
-
-