public class EnumResolver extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
protected Enum<?> |
_defaultValue |
protected Class<Enum<?>> |
_enumClass |
protected Enum<?>[] |
_enums |
protected HashMap<String,Enum<?>> |
_enumsById |
protected boolean |
_isFromIntValue
Marker for case where value may come from
@JsonValue annotated
accessor and is expected/likely to come from actual integral number
value (and not String). |
protected boolean |
_isIgnoreCase
Marker for case-insensitive handling
|
Modifier | Constructor and Description |
---|---|
protected |
EnumResolver(Class<Enum<?>> enumClass,
Enum<?>[] enums,
HashMap<String,Enum<?>> map,
Enum<?> defaultValue,
boolean isIgnoreCase)
Deprecated.
Since 2.13 -- remove from 2.16
|
protected |
EnumResolver(Class<Enum<?>> enumClass,
Enum<?>[] enums,
HashMap<String,Enum<?>> map,
Enum<?> defaultValue,
boolean isIgnoreCase,
boolean isFromIntValue) |
Modifier and Type | Method and Description |
---|---|
protected static EnumResolver |
_constructFor(DeserializationConfig config,
Class<?> enumCls0) |
protected static EnumResolver |
_constructUsingMethod(DeserializationConfig config,
Class<?> enumCls0,
AnnotatedMember accessor) |
protected static EnumResolver |
_constructUsingToString(DeserializationConfig config,
Class<?> enumCls0) |
protected static Class<Enum<?>> |
_enumClass(Class<?> enumCls0) |
protected static Enum<?>[] |
_enumConstants(Class<?> enumCls) |
protected static Enum<?> |
_enumDefault(AnnotationIntrospector intr,
Class<?> enumCls) |
protected Enum<?> |
_findEnumCaseInsensitive(String key) |
protected static boolean |
_isIntType(Class<?> erasedType) |
static EnumResolver |
constructFor(DeserializationConfig config,
Class<?> enumCls)
Factory method for constructing resolver that maps from Enum.name() into
Enum value.
|
CompactStringObjectMap |
constructLookup() |
static EnumResolver |
constructUsingEnumNamingStrategy(DeserializationConfig config,
Class<?> enumCls,
EnumNamingStrategy enumNamingStrategy)
Factory method for constructing resolver that maps the name of enums converted to external property
names into Enum value using an implementation of
EnumNamingStrategy . |
static EnumResolver |
constructUsingIndex(DeserializationConfig config,
Class<Enum<?>> enumCls)
Factory method for constructing resolver that maps from index of Enum.values() into
Enum value
|
static EnumResolver |
constructUsingMethod(DeserializationConfig config,
Class<?> enumCls,
AnnotatedMember accessor)
Method used when actual String serialization is indicated using @JsonValue
on a method in Enum class.
|
static EnumResolver |
constructUsingToString(DeserializationConfig config,
Class<?> enumCls)
Factory method for constructing resolver that maps from Enum.toString() into
Enum value
|
Enum<?> |
findEnum(String key) |
Enum<?> |
getDefaultValue() |
Enum<?> |
getEnum(int index) |
Class<Enum<?>> |
getEnumClass() |
Collection<String> |
getEnumIds() |
List<Enum<?>> |
getEnums() |
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 to Enum.index() . |
int |
lastValidIndex() |
protected final Enum<?>[] _enums
protected final Enum<?> _defaultValue
protected final boolean _isIgnoreCase
protected final boolean _isFromIntValue
@JsonValue
annotated
accessor and is expected/likely to come from actual integral number
value (and not String).
Special case is needed since this specifically means that Enum.index()
should NOT be used or default to.
protected EnumResolver(Class<Enum<?>> enumClass, Enum<?>[] enums, HashMap<String,Enum<?>> map, Enum<?> defaultValue, boolean isIgnoreCase, boolean isFromIntValue)
public static EnumResolver constructFor(DeserializationConfig config, Class<?> enumCls)
protected static EnumResolver _constructFor(DeserializationConfig config, Class<?> enumCls0)
public static EnumResolver constructUsingToString(DeserializationConfig config, Class<?> enumCls)
public static EnumResolver constructUsingIndex(DeserializationConfig config, Class<Enum<?>> enumCls)
public static EnumResolver constructUsingEnumNamingStrategy(DeserializationConfig config, Class<?> enumCls, EnumNamingStrategy enumNamingStrategy)
EnumNamingStrategy
.
The output EnumResolver
should contain values that are symmetric to
EnumValues.constructUsingEnumNamingStrategy(MapperConfig, Class, EnumNamingStrategy)
.protected static EnumResolver _constructUsingToString(DeserializationConfig config, Class<?> enumCls0)
public static EnumResolver constructUsingMethod(DeserializationConfig config, Class<?> enumCls, AnnotatedMember accessor)
protected static EnumResolver _constructUsingMethod(DeserializationConfig config, Class<?> enumCls0, AnnotatedMember accessor)
public CompactStringObjectMap constructLookup()
protected static Enum<?> _enumDefault(AnnotationIntrospector intr, Class<?> enumCls)
protected static boolean _isIntType(Class<?> erasedType)
public Enum<?> getEnum(int index)
public Enum<?> getDefaultValue()
public Enum<?>[] getRawEnums()
public Collection<String> getEnumIds()
public int lastValidIndex()
public boolean isFromIntValue()
@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 to Enum.index()
.Copyright © 2008–2023 FasterXML. All rights reserved.