类 EnumDeserializer
java.lang.Object
com.fasterxml.jackson.databind.JsonDeserializer<T>
com.fasterxml.jackson.databind.deser.std.StdDeserializer<T>
com.fasterxml.jackson.databind.deser.std.StdScalarDeserializer<Object>
com.fasterxml.jackson.databind.deser.std.EnumDeserializer
- 所有已实现的接口:
com.fasterxml.jackson.databind.deser.ContextualDeserializer,com.fasterxml.jackson.databind.deser.NullValueProvider,com.fasterxml.jackson.databind.deser.ValueInstantiator.Gettable,Serializable
@Deprecated
public class EnumDeserializer
extends com.fasterxml.jackson.databind.deser.std.StdScalarDeserializer<Object>
implements com.fasterxml.jackson.databind.deser.ContextualDeserializer
已过时。
枚举类反序列化程序类,可以从字符串和整数反序列化指定枚举类的实例。
官方提供的,支持(但不限于)以下接收方式:
1、字符串 如:sex: "M"
2、数字 如:sex: 1 // 数字需要和枚举类的顺序对应,超过会报错。 如Sex 有M、W、N ,则数字只能是 0、1、2
3、数组 还不清楚怎么使用...
我重写了后,增强了以下功能。 1、传递的枚举类型可以是对象. 如: sex: { "code": "M" }
本类跟jackson-databind包中的EnumDeserializer类同包名,利用类加载机制,会加载此类,不会加载到jackson-databind中的类 参考 BasicDeserializerFactory#1495 行代码
- 版本:
- 3.2.1
- 作者:
- zuihou
- 另请参阅:
-
嵌套类概要
从类继承的嵌套类/接口 com.fasterxml.jackson.databind.JsonDeserializer
com.fasterxml.jackson.databind.JsonDeserializer.None -
字段概要
字段修饰符和类型字段说明protected final Boolean已过时。protected Object[]已过时。protected final boolean已过时。protected final com.fasterxml.jackson.databind.util.CompactStringObjectMap已过时。protected final com.fasterxml.jackson.databind.util.CompactStringObjectMap已过时。protected com.fasterxml.jackson.databind.util.CompactStringObjectMap已过时。从类继承的字段 com.fasterxml.jackson.databind.deser.std.StdDeserializer
_valueClass, _valueType, F_MASK_ACCEPT_ARRAYS, F_MASK_INT_COERCIONS -
构造器概要
构造器限定符构造器说明protectedEnumDeserializer(EnumDeserializer base, Boolean caseInsensitive) 已过时。protectedEnumDeserializer(EnumDeserializer base, Boolean caseInsensitive, Boolean useDefaultValueForUnknownEnum, Boolean useNullForUnknownEnum) 已过时。EnumDeserializer(com.fasterxml.jackson.databind.util.EnumResolver byNameResolver) 已过时。EnumDeserializer(com.fasterxml.jackson.databind.util.EnumResolver byNameResolver, boolean caseInsensitive, com.fasterxml.jackson.databind.util.EnumResolver byEnumNamingResolver) 已过时。EnumDeserializer(com.fasterxml.jackson.databind.util.EnumResolver byNameResolver, boolean caseInsensitive, com.fasterxml.jackson.databind.util.EnumResolver byEnumNamingResolver, com.fasterxml.jackson.databind.util.EnumResolver toStringResolver) 已过时。EnumDeserializer(com.fasterxml.jackson.databind.util.EnumResolver byNameResolver, Boolean caseInsensitive) 已过时。 -
方法概要
修饰符和类型方法说明protected Object_deserializeOther(com.fasterxml.jackson.core.JsonParser p, com.fasterxml.jackson.databind.DeserializationContext ctxt) 已过时。protected Class<?>已过时。protected Object_fromInteger(com.fasterxml.jackson.core.JsonParser p, com.fasterxml.jackson.databind.DeserializationContext ctxt, int index) 已过时。protected Object_fromString(com.fasterxml.jackson.core.JsonParser p, com.fasterxml.jackson.databind.DeserializationContext ctxt, String text) 已过时。protected com.fasterxml.jackson.databind.util.CompactStringObjectMap_getToStringLookup(com.fasterxml.jackson.databind.DeserializationContext ctxt) 已过时。com.fasterxml.jackson.databind.JsonDeserializer<?>createContextual(com.fasterxml.jackson.databind.DeserializationContext ctxt, com.fasterxml.jackson.databind.BeanProperty property) 已过时。deserialize(com.fasterxml.jackson.core.JsonParser p, com.fasterxml.jackson.databind.DeserializationContext ctxt) 已过时。static com.fasterxml.jackson.databind.JsonDeserializer<?>deserializerForCreator(com.fasterxml.jackson.databind.DeserializationConfig config, Class<?> enumClass, com.fasterxml.jackson.databind.introspect.AnnotatedMethod factory) 已过时。static com.fasterxml.jackson.databind.JsonDeserializer<?>deserializerForCreator(com.fasterxml.jackson.databind.DeserializationConfig config, Class<?> enumClass, com.fasterxml.jackson.databind.introspect.AnnotatedMethod factory, com.fasterxml.jackson.databind.deser.ValueInstantiator valueInstantiator, com.fasterxml.jackson.databind.deser.SettableBeanProperty[] creatorProps) 已过时。static com.fasterxml.jackson.databind.JsonDeserializer<?>deserializerForNoArgsCreator(com.fasterxml.jackson.databind.DeserializationConfig config, Class<?> enumClass, com.fasterxml.jackson.databind.introspect.AnnotatedMethod factory) 已过时。getEmptyValue(com.fasterxml.jackson.databind.DeserializationContext ctxt) 已过时。boolean已过时。com.fasterxml.jackson.databind.type.LogicalType已过时。protected booleanuseDefaultValueForUnknownEnum(com.fasterxml.jackson.databind.DeserializationContext ctxt) 已过时。protected booleanuseNullForUnknownEnum(com.fasterxml.jackson.databind.DeserializationContext ctxt) 已过时。withResolved(Boolean caseInsensitive) 已过时。withResolved(Boolean caseInsensitive, Boolean useDefaultValueForUnknownEnum, Boolean useNullForUnknownEnum) 已过时。从类继承的方法 com.fasterxml.jackson.databind.deser.std.StdScalarDeserializer
deserialize, deserializeWithType, getEmptyAccessPattern, getNullAccessPattern, supportsUpdate从类继承的方法 com.fasterxml.jackson.databind.deser.std.StdDeserializer
_byteOverflow, _checkBooleanToStringCoercion, _checkCoercionFail, _checkDoubleSpecialValue, _checkFloatSpecialValue, _checkFloatToIntCoercion, _checkFloatToStringCoercion, _checkFromStringCoercion, _checkFromStringCoercion, _checkIntToFloatCoercion, _checkIntToStringCoercion, _checkTextualNull, _checkToStringCoercion, _coerceBooleanFromInt, _coercedTypeDesc, _coercedTypeDesc, _coerceEmptyString, _coerceIntegral, _coerceNullToken, _coerceTextualNull, _deserializeFromArray, _deserializeFromEmpty, _deserializeFromEmptyString, _deserializeFromString, _deserializeWrappedValue, _failDoubleToIntCoercion, _findCoercionFromBlankString, _findCoercionFromEmptyArray, _findCoercionFromEmptyString, _findNullProvider, _hasTextualNull, _intOverflow, _isBlank, _isEmptyOrTextualNull, _isFalse, _isIntNumber, _isNaN, _isNegInf, _isPosInf, _isTrue, _neitherNull, _nonNullNumber, _parseBoolean, _parseBooleanFromInt, _parseBooleanPrimitive, _parseBooleanPrimitive, _parseBytePrimitive, _parseDate, _parseDate, _parseDateFromArray, _parseDouble, _parseDouble, _parseDoublePrimitive, _parseDoublePrimitive, _parseDoublePrimitive, _parseFloatPrimitive, _parseFloatPrimitive, _parseFloatPrimitive, _parseInteger, _parseInteger, _parseIntPrimitive, _parseIntPrimitive, _parseLong, _parseLong, _parseLongPrimitive, _parseLongPrimitive, _parseShortPrimitive, _parseString, _parseString, _reportFailedNullCoerce, _shortOverflow, _verifyEndArrayForSingle, _verifyNullForPrimitive, _verifyNullForPrimitiveCoercion, _verifyNullForScalarCoercion, _verifyNumberForScalarCoercion, _verifyStringForScalarCoercion, findContentNullProvider, findContentNullStyle, findConvertingContentDeserializer, findDeserializer, findFormatFeature, findFormatOverrides, findValueNullProvider, getValueClass, getValueInstantiator, getValueType, getValueType, handledType, handleMissingEndArrayForSingle, handleNestedArrayForSingle, handleUnknownProperty, isDefaultDeserializer, isDefaultKeyDeserializer从类继承的方法 com.fasterxml.jackson.databind.JsonDeserializer
deserializeWithType, findBackReference, getAbsentValue, getDelegatee, getEmptyValue, getKnownPropertyNames, getNullValue, getNullValue, getObjectIdReader, replaceDelegatee, unwrappingDeserializer
-
字段详细资料
-
_enumsByIndex
已过时。 -
_lookupByName
protected final com.fasterxml.jackson.databind.util.CompactStringObjectMap _lookupByName已过时。 -
_lookupByToString
protected volatile com.fasterxml.jackson.databind.util.CompactStringObjectMap _lookupByToString已过时。 -
_caseInsensitive
已过时。 -
_isFromIntValue
protected final boolean _isFromIntValue已过时。 -
_lookupByEnumNaming
protected final com.fasterxml.jackson.databind.util.CompactStringObjectMap _lookupByEnumNaming已过时。
-
-
构造器详细资料
-
EnumDeserializer
@Deprecated public EnumDeserializer(com.fasterxml.jackson.databind.util.EnumResolver byNameResolver, Boolean caseInsensitive) 已过时。 -
EnumDeserializer
@Deprecated public EnumDeserializer(com.fasterxml.jackson.databind.util.EnumResolver byNameResolver, boolean caseInsensitive, com.fasterxml.jackson.databind.util.EnumResolver byEnumNamingResolver) 已过时。 -
EnumDeserializer
public EnumDeserializer(com.fasterxml.jackson.databind.util.EnumResolver byNameResolver, boolean caseInsensitive, com.fasterxml.jackson.databind.util.EnumResolver byEnumNamingResolver, com.fasterxml.jackson.databind.util.EnumResolver toStringResolver) 已过时。 -
EnumDeserializer
protected EnumDeserializer(EnumDeserializer base, Boolean caseInsensitive, Boolean useDefaultValueForUnknownEnum, Boolean useNullForUnknownEnum) 已过时。 -
EnumDeserializer
已过时。 -
EnumDeserializer
@Deprecated public EnumDeserializer(com.fasterxml.jackson.databind.util.EnumResolver byNameResolver) 已过时。
-
-
方法详细资料
-
deserializerForCreator
@Deprecated public static com.fasterxml.jackson.databind.JsonDeserializer<?> deserializerForCreator(com.fasterxml.jackson.databind.DeserializationConfig config, Class<?> enumClass, com.fasterxml.jackson.databind.introspect.AnnotatedMethod factory) 已过时。 -
deserializerForCreator
public static com.fasterxml.jackson.databind.JsonDeserializer<?> deserializerForCreator(com.fasterxml.jackson.databind.DeserializationConfig config, Class<?> enumClass, com.fasterxml.jackson.databind.introspect.AnnotatedMethod factory, com.fasterxml.jackson.databind.deser.ValueInstantiator valueInstantiator, com.fasterxml.jackson.databind.deser.SettableBeanProperty[] creatorProps) 已过时。 -
deserializerForNoArgsCreator
public static com.fasterxml.jackson.databind.JsonDeserializer<?> deserializerForNoArgsCreator(com.fasterxml.jackson.databind.DeserializationConfig config, Class<?> enumClass, com.fasterxml.jackson.databind.introspect.AnnotatedMethod factory) 已过时。 -
withResolved
public EnumDeserializer withResolved(Boolean caseInsensitive, Boolean useDefaultValueForUnknownEnum, Boolean useNullForUnknownEnum) 已过时。 -
withResolved
已过时。 -
createContextual
public com.fasterxml.jackson.databind.JsonDeserializer<?> createContextual(com.fasterxml.jackson.databind.DeserializationContext ctxt, com.fasterxml.jackson.databind.BeanProperty property) throws com.fasterxml.jackson.databind.JsonMappingException 已过时。- 指定者:
createContextual在接口中com.fasterxml.jackson.databind.deser.ContextualDeserializer- 抛出:
com.fasterxml.jackson.databind.JsonMappingException
-
isCachable
public boolean isCachable()已过时。- 覆盖:
isCachable在类中com.fasterxml.jackson.databind.JsonDeserializer<Object>
-
logicalType
public com.fasterxml.jackson.databind.type.LogicalType logicalType()已过时。- 覆盖:
logicalType在类中com.fasterxml.jackson.databind.deser.std.StdScalarDeserializer<Object>
-
getEmptyValue
public Object getEmptyValue(com.fasterxml.jackson.databind.DeserializationContext ctxt) throws com.fasterxml.jackson.databind.JsonMappingException 已过时。- 覆盖:
getEmptyValue在类中com.fasterxml.jackson.databind.JsonDeserializer<Object>- 抛出:
com.fasterxml.jackson.databind.JsonMappingException
-
deserialize
public Object deserialize(com.fasterxml.jackson.core.JsonParser p, com.fasterxml.jackson.databind.DeserializationContext ctxt) throws IOException 已过时。- 指定者:
deserialize在类中com.fasterxml.jackson.databind.JsonDeserializer<Object>- 抛出:
IOException
-
_fromString
protected Object _fromString(com.fasterxml.jackson.core.JsonParser p, com.fasterxml.jackson.databind.DeserializationContext ctxt, String text) throws IOException 已过时。- 抛出:
IOException
-
_fromInteger
protected Object _fromInteger(com.fasterxml.jackson.core.JsonParser p, com.fasterxml.jackson.databind.DeserializationContext ctxt, int index) throws IOException 已过时。- 抛出:
IOException
-
_deserializeOther
protected Object _deserializeOther(com.fasterxml.jackson.core.JsonParser p, com.fasterxml.jackson.databind.DeserializationContext ctxt) throws IOException 已过时。- 抛出:
IOException
-
_enumClass
已过时。 -
_getToStringLookup
@Deprecated protected com.fasterxml.jackson.databind.util.CompactStringObjectMap _getToStringLookup(com.fasterxml.jackson.databind.DeserializationContext ctxt) 已过时。 -
useNullForUnknownEnum
protected boolean useNullForUnknownEnum(com.fasterxml.jackson.databind.DeserializationContext ctxt) 已过时。 -
useDefaultValueForUnknownEnum
protected boolean useDefaultValueForUnknownEnum(com.fasterxml.jackson.databind.DeserializationContext ctxt) 已过时。
-