public abstract class StdDeserializer<T> extends JsonDeserializer<T> implements java.io.Serializable
JsonDeserializer.None
Modifier and Type | Field and Description |
---|---|
protected java.lang.Class<?> |
_valueClass
Type of values this deserializer handles: sometimes
exact types, other time most specific supertype of
types deserializer handles (which may be as generic
as
Object in some case) |
protected static int |
F_MASK_ACCEPT_ARRAYS |
protected static int |
F_MASK_INT_COERCIONS
Bitmask that covers
DeserializationFeature.USE_BIG_INTEGER_FOR_INTS
and DeserializationFeature.USE_LONG_FOR_INTS , used for more efficient
cheks when coercing integral values for untyped deserialization. |
private static long |
serialVersionUID |
Modifier | Constructor and Description |
---|---|
protected |
StdDeserializer(java.lang.Class<?> vc) |
protected |
StdDeserializer(JavaType valueType) |
protected |
StdDeserializer(StdDeserializer<?> src)
Copy-constructor for sub-classes to use, most often when creating
new instances for
ContextualDeserializer . |
Modifier and Type | Method and Description |
---|---|
protected boolean |
_byteOverflow(int value) |
protected java.lang.String |
_coercedTypeDesc()
Helper method called to get a description of type into which a scalar value coercion
is (most likely) being applied, to be used for constructing exception messages
on coerce failure.
|
protected java.lang.Object |
_coerceEmptyString(DeserializationContext ctxt,
boolean isPrimitive)
Method called when JSON String with value "" (that is, zero length) is encountered.
|
protected java.lang.Object |
_coerceIntegral(com.fasterxml.jackson.core.JsonParser p,
DeserializationContext ctxt)
Helper method called in case where an integral number is encountered, but
config settings suggest that a coercion may be needed to "upgrade"
Number into "bigger" type like Long or
BigInteger |
protected java.lang.Object |
_coerceNullToken(DeserializationContext ctxt,
boolean isPrimitive)
Method to call when JSON `null` token is encountered.
|
protected java.lang.Object |
_coerceTextualNull(DeserializationContext ctxt,
boolean isPrimitive)
Method called when JSON String with value "null" is encountered.
|
protected T |
_deserializeFromArray(com.fasterxml.jackson.core.JsonParser p,
DeserializationContext ctxt)
Helper method that allows easy support for array-related
DeserializationFeature s
`ACCEPT_EMPTY_ARRAY_AS_NULL_OBJECT` and `UNWRAP_SINGLE_VALUE_ARRAYS`: checks for either
empty array, or single-value array-wrapped value (respectively), and either reports
an exception (if no match, or feature(s) not enabled), or returns appropriate
result value. |
protected T |
_deserializeFromEmpty(com.fasterxml.jackson.core.JsonParser p,
DeserializationContext ctxt)
Helper method that may be used to support fallback for Empty String / Empty Array
non-standard representations; usually for things serialized as JSON Objects.
|
protected T |
_deserializeWrappedValue(com.fasterxml.jackson.core.JsonParser p,
DeserializationContext ctxt)
Helper called to support
DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS :
default implementation simply calls
JsonDeserializer.deserialize(JsonParser, DeserializationContext) ,
but handling may be overridden. |
protected void |
_failDoubleToIntCoercion(com.fasterxml.jackson.core.JsonParser p,
DeserializationContext ctxt,
java.lang.String type) |
protected NullValueProvider |
_findNullProvider(DeserializationContext ctxt,
BeanProperty prop,
com.fasterxml.jackson.annotation.Nulls nulls,
JsonDeserializer<?> valueDeser) |
protected boolean |
_hasTextualNull(java.lang.String value)
Helper method called to determine if we are seeing String value of
"null", and, further, that it should be coerced to null just like
null token.
|
protected boolean |
_intOverflow(long value) |
protected boolean |
_isEmptyOrTextualNull(java.lang.String value) |
protected boolean |
_isIntNumber(java.lang.String text)
Helper method to check whether given text refers to what looks like a clean simple
integer number, consisting of optional sign followed by a sequence of digits.
|
protected boolean |
_isNaN(java.lang.String text) |
protected boolean |
_isNegInf(java.lang.String text) |
protected boolean |
_isPosInf(java.lang.String text) |
protected static boolean |
_neitherNull(java.lang.Object a,
java.lang.Object b) |
protected java.lang.Number |
_nonNullNumber(java.lang.Number n) |
protected boolean |
_parseBooleanFromInt(com.fasterxml.jackson.core.JsonParser p,
DeserializationContext ctxt) |
protected boolean |
_parseBooleanPrimitive(com.fasterxml.jackson.core.JsonParser p,
DeserializationContext ctxt) |
protected byte |
_parseBytePrimitive(com.fasterxml.jackson.core.JsonParser p,
DeserializationContext ctxt) |
protected java.util.Date |
_parseDate(com.fasterxml.jackson.core.JsonParser p,
DeserializationContext ctxt) |
protected java.util.Date |
_parseDate(java.lang.String value,
DeserializationContext ctxt) |
protected java.util.Date |
_parseDateFromArray(com.fasterxml.jackson.core.JsonParser p,
DeserializationContext ctxt) |
protected double |
_parseDoublePrimitive(DeserializationContext ctxt,
java.lang.String text) |
protected double |
_parseDoublePrimitive(com.fasterxml.jackson.core.JsonParser p,
DeserializationContext ctxt) |
protected float |
_parseFloatPrimitive(DeserializationContext ctxt,
java.lang.String text) |
protected float |
_parseFloatPrimitive(com.fasterxml.jackson.core.JsonParser p,
DeserializationContext ctxt) |
protected int |
_parseIntPrimitive(DeserializationContext ctxt,
java.lang.String text) |
protected int |
_parseIntPrimitive(com.fasterxml.jackson.core.JsonParser p,
DeserializationContext ctxt) |
protected long |
_parseLongPrimitive(DeserializationContext ctxt,
java.lang.String text) |
protected long |
_parseLongPrimitive(com.fasterxml.jackson.core.JsonParser p,
DeserializationContext ctxt) |
protected short |
_parseShortPrimitive(com.fasterxml.jackson.core.JsonParser p,
DeserializationContext ctxt) |
protected java.lang.String |
_parseString(com.fasterxml.jackson.core.JsonParser p,
DeserializationContext ctxt)
Helper method used for accessing String value, if possible, doing
necessary conversion or throwing exception as necessary.
|
protected void |
_reportFailedNullCoerce(DeserializationContext ctxt,
boolean state,
java.lang.Enum<?> feature,
java.lang.String inputDesc) |
protected boolean |
_shortOverflow(int value) |
protected void |
_verifyEndArrayForSingle(com.fasterxml.jackson.core.JsonParser p,
DeserializationContext ctxt) |
protected void |
_verifyNullForPrimitive(DeserializationContext ctxt) |
protected void |
_verifyNullForPrimitiveCoercion(DeserializationContext ctxt,
java.lang.String str) |
protected void |
_verifyNullForScalarCoercion(DeserializationContext ctxt,
java.lang.String str) |
protected void |
_verifyNumberForScalarCoercion(DeserializationContext ctxt,
com.fasterxml.jackson.core.JsonParser p) |
protected void |
_verifyStringForScalarCoercion(DeserializationContext ctxt,
java.lang.String str) |
java.lang.Object |
deserializeWithType(com.fasterxml.jackson.core.JsonParser p,
DeserializationContext ctxt,
TypeDeserializer typeDeserializer)
Base implementation that does not assume specific type
inclusion mechanism.
|
protected NullValueProvider |
findContentNullProvider(DeserializationContext ctxt,
BeanProperty prop,
JsonDeserializer<?> valueDeser)
Method called to find
NullValueProvider for a contents of a structured
primary property (Collection, Map, array), using
"content nulls" setting. |
protected com.fasterxml.jackson.annotation.Nulls |
findContentNullStyle(DeserializationContext ctxt,
BeanProperty prop) |
protected JsonDeserializer<?> |
findConvertingContentDeserializer(DeserializationContext ctxt,
BeanProperty prop,
JsonDeserializer<?> existingDeserializer)
Helper method that can be used to see if specified property has annotation
indicating that a converter is to be used for contained values (contents
of structured types; array/List/Map values)
|
protected JsonDeserializer<java.lang.Object> |
findDeserializer(DeserializationContext ctxt,
JavaType type,
BeanProperty property)
Helper method used to locate deserializers for properties the
type this deserializer handles contains (usually for properties of
bean types)
|
protected java.lang.Boolean |
findFormatFeature(DeserializationContext ctxt,
BeanProperty prop,
java.lang.Class<?> typeForDefaults,
com.fasterxml.jackson.annotation.JsonFormat.Feature feat)
Convenience method that uses
findFormatOverrides(com.fasterxml.jackson.databind.DeserializationContext, com.fasterxml.jackson.databind.BeanProperty, java.lang.Class<?>) to find possible
defaults and/of overrides, and then calls
JsonFormat.Value.getFeature(feat)
to find whether that feature has been specifically marked as enabled or disabled. |
protected com.fasterxml.jackson.annotation.JsonFormat.Value |
findFormatOverrides(DeserializationContext ctxt,
BeanProperty prop,
java.lang.Class<?> typeForDefaults)
Helper method that may be used to find if this deserializer has specific
JsonFormat settings, either via property, or through type-specific
defaulting. |
protected NullValueProvider |
findValueNullProvider(DeserializationContext ctxt,
SettableBeanProperty prop,
PropertyMetadata propMetadata)
Method called to find
NullValueProvider for a primary property, using
"value nulls" setting. |
java.lang.Class<?> |
getValueClass()
Deprecated.
Since 2.3 use
handledType() instead |
JavaType |
getValueType()
Exact structured type this deserializer handles, if known.
|
java.lang.Class<?> |
handledType()
Method for accessing type of values this deserializer produces.
|
protected void |
handleMissingEndArrayForSingle(com.fasterxml.jackson.core.JsonParser p,
DeserializationContext ctxt) |
protected void |
handleUnknownProperty(com.fasterxml.jackson.core.JsonParser p,
DeserializationContext ctxt,
java.lang.Object instanceOrClass,
java.lang.String propName)
Method called to deal with a property that did not map to a known
Bean property.
|
protected boolean |
isDefaultDeserializer(JsonDeserializer<?> deserializer)
Method that can be called to determine if given deserializer is the default
deserializer Jackson uses; as opposed to a custom deserializer installed by
a module or calling application.
|
protected boolean |
isDefaultKeyDeserializer(KeyDeserializer keyDeser) |
protected static double |
parseDouble(java.lang.String numStr)
Helper method for encapsulating calls to low-level double value parsing; single place
just because we need a work-around that must be applied to all calls.
|
deserialize, deserialize, findBackReference, getDelegatee, getEmptyAccessPattern, getEmptyValue, getEmptyValue, getKnownPropertyNames, getNullAccessPattern, getNullValue, getNullValue, getObjectIdReader, isCachable, replaceDelegatee, supportsUpdate, unwrappingDeserializer
private static final long serialVersionUID
protected static final int F_MASK_INT_COERCIONS
DeserializationFeature.USE_BIG_INTEGER_FOR_INTS
and DeserializationFeature.USE_LONG_FOR_INTS
, used for more efficient
cheks when coercing integral values for untyped deserialization.protected static final int F_MASK_ACCEPT_ARRAYS
protected final java.lang.Class<?> _valueClass
Object
in some case)protected StdDeserializer(java.lang.Class<?> vc)
protected StdDeserializer(JavaType valueType)
protected StdDeserializer(StdDeserializer<?> src)
ContextualDeserializer
.public java.lang.Class<?> handledType()
JsonDeserializer
Default implementation will return null, which means almost same
same as returning Object.class
would; that is, that
nothing is known about handled type.
handledType
in class JsonDeserializer<T>
@Deprecated public final java.lang.Class<?> getValueClass()
handledType()
insteadpublic JavaType getValueType()
Default implementation just returns null.
protected boolean isDefaultDeserializer(JsonDeserializer<?> deserializer)
JacksonStdImpl
annotation on deserializer class.protected boolean isDefaultKeyDeserializer(KeyDeserializer keyDeser)
public java.lang.Object deserializeWithType(com.fasterxml.jackson.core.JsonParser p, DeserializationContext ctxt, TypeDeserializer typeDeserializer) throws java.io.IOException
deserializeWithType
in class JsonDeserializer<T>
typeDeserializer
- Deserializer to use for handling type informationjava.io.IOException
protected final boolean _parseBooleanPrimitive(com.fasterxml.jackson.core.JsonParser p, DeserializationContext ctxt) throws java.io.IOException
java.io.IOException
protected boolean _parseBooleanFromInt(com.fasterxml.jackson.core.JsonParser p, DeserializationContext ctxt) throws java.io.IOException
java.io.IOException
protected final byte _parseBytePrimitive(com.fasterxml.jackson.core.JsonParser p, DeserializationContext ctxt) throws java.io.IOException
java.io.IOException
protected final short _parseShortPrimitive(com.fasterxml.jackson.core.JsonParser p, DeserializationContext ctxt) throws java.io.IOException
java.io.IOException
protected final int _parseIntPrimitive(com.fasterxml.jackson.core.JsonParser p, DeserializationContext ctxt) throws java.io.IOException
java.io.IOException
protected final int _parseIntPrimitive(DeserializationContext ctxt, java.lang.String text) throws java.io.IOException
java.io.IOException
protected final long _parseLongPrimitive(com.fasterxml.jackson.core.JsonParser p, DeserializationContext ctxt) throws java.io.IOException
java.io.IOException
protected final long _parseLongPrimitive(DeserializationContext ctxt, java.lang.String text) throws java.io.IOException
java.io.IOException
protected final float _parseFloatPrimitive(com.fasterxml.jackson.core.JsonParser p, DeserializationContext ctxt) throws java.io.IOException
java.io.IOException
protected final float _parseFloatPrimitive(DeserializationContext ctxt, java.lang.String text) throws java.io.IOException
java.io.IOException
protected final double _parseDoublePrimitive(com.fasterxml.jackson.core.JsonParser p, DeserializationContext ctxt) throws java.io.IOException
java.io.IOException
protected final double _parseDoublePrimitive(DeserializationContext ctxt, java.lang.String text) throws java.io.IOException
java.io.IOException
protected java.util.Date _parseDate(com.fasterxml.jackson.core.JsonParser p, DeserializationContext ctxt) throws java.io.IOException
java.io.IOException
protected java.util.Date _parseDateFromArray(com.fasterxml.jackson.core.JsonParser p, DeserializationContext ctxt) throws java.io.IOException
java.io.IOException
protected java.util.Date _parseDate(java.lang.String value, DeserializationContext ctxt) throws java.io.IOException
java.io.IOException
protected static final double parseDouble(java.lang.String numStr) throws java.lang.NumberFormatException
java.lang.NumberFormatException
protected final java.lang.String _parseString(com.fasterxml.jackson.core.JsonParser p, DeserializationContext ctxt) throws java.io.IOException
java.io.IOException
protected T _deserializeFromEmpty(com.fasterxml.jackson.core.JsonParser p, DeserializationContext ctxt) throws java.io.IOException
java.io.IOException
protected boolean _hasTextualNull(java.lang.String value)
protected boolean _isEmptyOrTextualNull(java.lang.String value)
protected final boolean _isNegInf(java.lang.String text)
protected final boolean _isPosInf(java.lang.String text)
protected final boolean _isNaN(java.lang.String text)
protected T _deserializeFromArray(com.fasterxml.jackson.core.JsonParser p, DeserializationContext ctxt) throws java.io.IOException
DeserializationFeature
s
`ACCEPT_EMPTY_ARRAY_AS_NULL_OBJECT` and `UNWRAP_SINGLE_VALUE_ARRAYS`: checks for either
empty array, or single-value array-wrapped value (respectively), and either reports
an exception (if no match, or feature(s) not enabled), or returns appropriate
result value.
This method should NOT be called if Array representation is explicitly supported for type: it should only be called in case it is otherwise unrecognized.
NOTE: in case of unwrapped single element, will handle actual decoding
by calling _deserializeWrappedValue(com.fasterxml.jackson.core.JsonParser, com.fasterxml.jackson.databind.DeserializationContext)
, which by default calls
JsonDeserializer.deserialize(JsonParser, DeserializationContext)
.
java.io.IOException
protected T _deserializeWrappedValue(com.fasterxml.jackson.core.JsonParser p, DeserializationContext ctxt) throws java.io.IOException
DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS
:
default implementation simply calls
JsonDeserializer.deserialize(JsonParser, DeserializationContext)
,
but handling may be overridden.java.io.IOException
protected void _failDoubleToIntCoercion(com.fasterxml.jackson.core.JsonParser p, DeserializationContext ctxt, java.lang.String type) throws java.io.IOException
java.io.IOException
protected java.lang.Object _coerceIntegral(com.fasterxml.jackson.core.JsonParser p, DeserializationContext ctxt) throws java.io.IOException
Number
into "bigger" type like Long
or
BigInteger
java.io.IOException
DeserializationFeature.USE_BIG_INTEGER_FOR_INTS
,
DeserializationFeature.USE_LONG_FOR_INTS
protected java.lang.Object _coerceNullToken(DeserializationContext ctxt, boolean isPrimitive) throws JsonMappingException
JsonMappingException
protected java.lang.Object _coerceTextualNull(DeserializationContext ctxt, boolean isPrimitive) throws JsonMappingException
JsonMappingException
protected java.lang.Object _coerceEmptyString(DeserializationContext ctxt, boolean isPrimitive) throws JsonMappingException
JsonMappingException
protected final void _verifyNullForPrimitive(DeserializationContext ctxt) throws JsonMappingException
JsonMappingException
protected final void _verifyNullForPrimitiveCoercion(DeserializationContext ctxt, java.lang.String str) throws JsonMappingException
JsonMappingException
protected final void _verifyNullForScalarCoercion(DeserializationContext ctxt, java.lang.String str) throws JsonMappingException
JsonMappingException
protected void _verifyStringForScalarCoercion(DeserializationContext ctxt, java.lang.String str) throws JsonMappingException
JsonMappingException
protected void _verifyNumberForScalarCoercion(DeserializationContext ctxt, com.fasterxml.jackson.core.JsonParser p) throws java.io.IOException
java.io.IOException
protected void _reportFailedNullCoerce(DeserializationContext ctxt, boolean state, java.lang.Enum<?> feature, java.lang.String inputDesc) throws JsonMappingException
JsonMappingException
protected java.lang.String _coercedTypeDesc()
protected JsonDeserializer<java.lang.Object> findDeserializer(DeserializationContext ctxt, JavaType type, BeanProperty property) throws JsonMappingException
type
- Type of property to deserializeproperty
- Actual property object (field, method, constuctor parameter) used
for passing deserialized values; provided so deserializer can be contextualized if necessaryJsonMappingException
protected final boolean _isIntNumber(java.lang.String text)
protected JsonDeserializer<?> findConvertingContentDeserializer(DeserializationContext ctxt, BeanProperty prop, JsonDeserializer<?> existingDeserializer) throws JsonMappingException
existingDeserializer
- (optional) configured content
serializer if one already exists.JsonMappingException
protected com.fasterxml.jackson.annotation.JsonFormat.Value findFormatOverrides(DeserializationContext ctxt, BeanProperty prop, java.lang.Class<?> typeForDefaults)
JsonFormat
settings, either via property, or through type-specific
defaulting.typeForDefaults
- Type (erased) used for finding default format settings, if anyprotected java.lang.Boolean findFormatFeature(DeserializationContext ctxt, BeanProperty prop, java.lang.Class<?> typeForDefaults, com.fasterxml.jackson.annotation.JsonFormat.Feature feat)
findFormatOverrides(com.fasterxml.jackson.databind.DeserializationContext, com.fasterxml.jackson.databind.BeanProperty, java.lang.Class<?>)
to find possible
defaults and/of overrides, and then calls
JsonFormat.Value.getFeature(feat)
to find whether that feature has been specifically marked as enabled or disabled.typeForDefaults
- Type (erased) used for finding default format settings, if anyprotected final NullValueProvider findValueNullProvider(DeserializationContext ctxt, SettableBeanProperty prop, PropertyMetadata propMetadata) throws JsonMappingException
NullValueProvider
for a primary property, using
"value nulls" setting. If no provider found (not defined, or is "skip"),
will return `null`.JsonMappingException
protected NullValueProvider findContentNullProvider(DeserializationContext ctxt, BeanProperty prop, JsonDeserializer<?> valueDeser) throws JsonMappingException
NullValueProvider
for a contents of a structured
primary property (Collection, Map, array), using
"content nulls" setting. If no provider found (not defined),
will return given value deserializer (which is a null value provider itself).JsonMappingException
protected com.fasterxml.jackson.annotation.Nulls findContentNullStyle(DeserializationContext ctxt, BeanProperty prop) throws JsonMappingException
JsonMappingException
protected final NullValueProvider _findNullProvider(DeserializationContext ctxt, BeanProperty prop, com.fasterxml.jackson.annotation.Nulls nulls, JsonDeserializer<?> valueDeser) throws JsonMappingException
JsonMappingException
protected void handleUnknownProperty(com.fasterxml.jackson.core.JsonParser p, DeserializationContext ctxt, java.lang.Object instanceOrClass, java.lang.String propName) throws java.io.IOException
p
- Parser that points to value of the unknown propertyctxt
- Context for deserialization; allows access to the parser,
error reporting functionalityinstanceOrClass
- Instance that is being populated by this
deserializer, or if not known, Class that would be instantiated.
If null, will assume type is what getValueClass()
returns.propName
- Name of the property that cannot be mappedjava.io.IOException
protected void handleMissingEndArrayForSingle(com.fasterxml.jackson.core.JsonParser p, DeserializationContext ctxt) throws java.io.IOException
java.io.IOException
protected void _verifyEndArrayForSingle(com.fasterxml.jackson.core.JsonParser p, DeserializationContext ctxt) throws java.io.IOException
java.io.IOException
protected static final boolean _neitherNull(java.lang.Object a, java.lang.Object b)
protected final boolean _byteOverflow(int value)
protected final boolean _shortOverflow(int value)
protected final boolean _intOverflow(long value)
protected java.lang.Number _nonNullNumber(java.lang.Number n)