public abstract class BeanDeserializerBase extends StdDeserializer<java.lang.Object> implements ContextualDeserializer, ResolvableDeserializer, java.io.Serializable
BeanDeserializer.JsonDeserializer.None| Modifier and Type | Field and Description |
|---|---|
protected SettableAnyProperty |
_anySetter
Fallback setter used for handling any properties that are not
mapped to regular setters.
|
protected java.util.Map<java.lang.String,SettableBeanProperty> |
_backRefs
We may also have one or more back reference fields (usually
zero or one).
|
protected BeanPropertyMap |
_beanProperties
Mapping of property names to properties, built when all properties
to use have been successfully resolved.
|
protected JavaType |
_beanType
Declared type of the bean this deserializer handles.
|
protected JsonDeserializer<java.lang.Object> |
_delegateDeserializer
Deserializer that is used iff delegate-based creator is
to be used for deserializing from JSON Object.
|
protected ExternalTypeHandler |
_externalTypeIdHandler
Handler that we need iff any of properties uses external
type id.
|
protected java.util.HashSet<java.lang.String> |
_ignorableProps
In addition to properties that are set, we will also keep
track of recognized but ignorable properties: these will
be skipped without errors or warnings.
|
protected boolean |
_ignoreAllUnknown
Flag that can be set to ignore and skip unknown properties.
|
protected ValueInjector[] |
_injectables
List of
ValueInjectors, if any injectable values are
expected by the bean; otherwise null. |
protected boolean |
_needViewProcesing
Flag that indicates that some aspect of deserialization depends
on active view used (if any)
|
protected boolean |
_nonStandardCreation
Flag that is set to mark "non-standard" cases; where either
we use one of non-default creators, or there are unwrapped
values to consider.
|
protected ObjectIdReader |
_objectIdReader
If an Object Id is to be used for value handled by this
deserializer, this reader is used for handling.
|
protected PropertyBasedCreator |
_propertyBasedCreator
If the bean needs to be instantiated using constructor
or factory method
that takes one or more named properties as argument(s),
this creator is used for instantiation.
|
protected com.fasterxml.jackson.annotation.JsonFormat.Shape |
_serializationShape
Requested shape from bean class annotations.
|
protected java.util.HashMap<ClassKey,JsonDeserializer<java.lang.Object>> |
_subDeserializers
Lazily constructed map used to contain deserializers needed
for polymorphic subtypes.
|
protected UnwrappedPropertyHandler |
_unwrappedPropertyHandler
If one of properties has "unwrapped" value, we need separate
helper object
|
protected ValueInstantiator |
_valueInstantiator
Object that handles details of constructing initial
bean value (to which bind data to), unless instance
is passed (via updateValue())
|
protected boolean |
_vanillaProcessing
Flag that indicates that no "special features" whatsoever
are enabled, so the simplest processing is possible.
|
_valueClass| Modifier | Constructor and Description |
|---|---|
protected |
BeanDeserializerBase(BeanDeserializerBase src) |
protected |
BeanDeserializerBase(BeanDeserializerBase src,
boolean ignoreAllUnknown) |
|
BeanDeserializerBase(BeanDeserializerBase src,
java.util.HashSet<java.lang.String> ignorableProps) |
protected |
BeanDeserializerBase(BeanDeserializerBase src,
NameTransformer unwrapper) |
|
BeanDeserializerBase(BeanDeserializerBase src,
ObjectIdReader oir) |
protected |
BeanDeserializerBase(BeanDeserializerBuilder builder,
BeanDescription beanDesc,
BeanPropertyMap properties,
java.util.Map<java.lang.String,SettableBeanProperty> backRefs,
java.util.HashSet<java.lang.String> ignorableProps,
boolean ignoreAllUnknown,
boolean hasViews)
Constructor used when initially building a deserializer
instance, given a
BeanDeserializerBuilder that
contains configuration. |
| Modifier and Type | Method and Description |
|---|---|
protected abstract java.lang.Object |
_deserializeUsingPropertyBased(com.fasterxml.jackson.core.JsonParser jp,
DeserializationContext ctxt) |
protected JsonDeserializer<java.lang.Object> |
_findSubclassDeserializer(DeserializationContext ctxt,
java.lang.Object bean,
TokenBuffer unknownTokens)
Helper method called to (try to) locate deserializer for given sub-type of
type that this deserializer handles.
|
protected SettableBeanProperty |
_resolveInnerClassValuedProperty(DeserializationContext ctxt,
SettableBeanProperty prop)
Helper method that will handle gruesome details of dealing with properties
that have non-static inner class as value...
|
protected SettableBeanProperty |
_resolveManagedReferenceProperty(DeserializationContext ctxt,
SettableBeanProperty prop)
Helper method called to see if given property is part of 'managed' property
pair (managed + back reference), and if so, handle resolution details.
|
protected SettableBeanProperty |
_resolveUnwrappedProperty(DeserializationContext ctxt,
SettableBeanProperty prop)
Helper method called to see if given property might be so-called unwrapped
property: these require special handling.
|
protected abstract BeanDeserializerBase |
asArrayDeserializer()
Fluent factory for creating a variant that can handle
POJO output as a JSON Array.
|
JsonDeserializer<?> |
createContextual(DeserializationContext ctxt,
BeanProperty property)
Although most of post-processing is done in resolve(), we only get
access to referring property's annotations here; and this is needed
to support per-property ObjectIds.
|
java.util.Iterator<SettableBeanProperty> |
creatorProperties()
Accessor for finding properties that represents values to pass
through property-based creator method (constructor or
factory method)
|
java.lang.Object |
deserializeFromArray(com.fasterxml.jackson.core.JsonParser jp,
DeserializationContext ctxt) |
java.lang.Object |
deserializeFromBoolean(com.fasterxml.jackson.core.JsonParser jp,
DeserializationContext ctxt)
Method called to deserialize POJO value from a JSON boolean value (true, false)
|
java.lang.Object |
deserializeFromDouble(com.fasterxml.jackson.core.JsonParser jp,
DeserializationContext ctxt)
Method called to deserialize POJO value from a JSON floating-point
number.
|
java.lang.Object |
deserializeFromNumber(com.fasterxml.jackson.core.JsonParser jp,
DeserializationContext ctxt) |
abstract java.lang.Object |
deserializeFromObject(com.fasterxml.jackson.core.JsonParser jp,
DeserializationContext ctxt)
General version used when handling needs more advanced
features.
|
protected java.lang.Object |
deserializeFromObjectId(com.fasterxml.jackson.core.JsonParser jp,
DeserializationContext ctxt)
Method called in cases where it looks like we got an Object Id
to parse and use as a reference.
|
protected java.lang.Object |
deserializeFromObjectUsingNonDefault(com.fasterxml.jackson.core.JsonParser jp,
DeserializationContext ctxt) |
java.lang.Object |
deserializeFromString(com.fasterxml.jackson.core.JsonParser jp,
DeserializationContext ctxt) |
protected java.lang.Object |
deserializeWithObjectId(com.fasterxml.jackson.core.JsonParser jp,
DeserializationContext ctxt)
Alternative deserialization method used when we expect to see Object Id;
if so, we will need to ensure that the Id is seen before anything
else, to ensure that it is available for solving references,
even if JSON itself is not ordered that way.
|
java.lang.Object |
deserializeWithType(com.fasterxml.jackson.core.JsonParser jp,
DeserializationContext ctxt,
TypeDeserializer typeDeserializer)
Base implementation that does not assume specific type
inclusion mechanism.
|
SettableBeanProperty |
findBackReference(java.lang.String logicalName)
Method needed by
BeanDeserializerFactory to properly link
managed- and back-reference pairs. |
protected JsonDeserializer<java.lang.Object> |
findConvertingDeserializer(DeserializationContext ctxt,
SettableBeanProperty prop)
Helper method that can be used to see if specified property is annotated
to indicate use of a converter for property value (in case of container types,
it is container type itself, not key or content type).
|
SettableBeanProperty |
findProperty(java.lang.String propertyName)
Accessor for finding the property with given name, if POJO
has one.
|
java.lang.Class<?> |
getBeanClass() |
java.util.Collection<java.lang.Object> |
getKnownPropertyNames()
Method that will
either return null to indicate that type being deserializers
has no concept of properties; or a collection of identifiers
for which
toString will give external property
name. |
ObjectIdReader |
getObjectIdReader()
Overridden to return true for those instances that are
handling value for which Object Identity handling is enabled
(either via value type or referring property).
|
int |
getPropertyCount()
Accessor for checking number of deserialized properties.
|
ValueInstantiator |
getValueInstantiator() |
JavaType |
getValueType()
Exact structured type deserializer handles, if known.
|
protected java.lang.Object |
handlePolymorphic(com.fasterxml.jackson.core.JsonParser jp,
DeserializationContext ctxt,
java.lang.Object bean,
TokenBuffer unknownTokens)
Method called in cases where we may have polymorphic deserialization
case: that is, type of Creator-constructed bean is not the type
of deserializer itself.
|
protected java.lang.Object |
handleUnknownProperties(DeserializationContext ctxt,
java.lang.Object bean,
TokenBuffer unknownTokens)
Method called to handle set of one or more unknown properties,
stored in their entirety in given
TokenBuffer
(as field entries, name and value). |
protected void |
handleUnknownProperty(com.fasterxml.jackson.core.JsonParser jp,
DeserializationContext ctxt,
java.lang.Object beanOrClass,
java.lang.String propName)
Method called when a JSON property is encountered that has not matching
setter, any-setter or field, and thus can not be assigned.
|
protected void |
handleUnknownVanilla(com.fasterxml.jackson.core.JsonParser jp,
DeserializationContext ctxt,
java.lang.Object bean,
java.lang.String propName)
Helper method called for an unknown property, when using "vanilla"
processing.
|
boolean |
hasProperty(java.lang.String propertyName) |
boolean |
hasViews() |
protected void |
injectValues(DeserializationContext ctxt,
java.lang.Object bean) |
boolean |
isCachable()
Method called to see if deserializer instance is cachable and
usable for other properties of same type (type for which instance
was created).
|
java.util.Iterator<SettableBeanProperty> |
properties()
Accessor for iterating over properties this deserializer uses; with
the exception that properties passed via Creator methods
(specifically, "property-based constructor") are not included,
but can be accessed separate by calling
creatorProperties() |
void |
replaceProperty(SettableBeanProperty original,
SettableBeanProperty replacement)
Method that can be used to replace an existing property with
a modified one.
|
void |
resolve(DeserializationContext ctxt)
Method called to finalize setup of this deserializer,
after deserializer itself has been registered.
|
abstract JsonDeserializer<java.lang.Object> |
unwrappingDeserializer(NameTransformer unwrapper)
Method that will return deserializer instance that is able
to handle "unwrapped" value instances
If no unwrapped instance can be constructed, will simply
return this object as-is.
|
abstract BeanDeserializerBase |
withIgnorableProperties(java.util.HashSet<java.lang.String> ignorableProps) |
abstract BeanDeserializerBase |
withObjectIdReader(ObjectIdReader oir) |
void |
wrapAndThrow(java.lang.Throwable t,
java.lang.Object bean,
int index,
DeserializationContext ctxt) |
void |
wrapAndThrow(java.lang.Throwable t,
java.lang.Object bean,
java.lang.String fieldName,
DeserializationContext ctxt)
Method that will modify caught exception (passed in as argument)
as necessary to include reference information, and to ensure it
is a subtype of
IOException, or an unchecked exception. |
protected void |
wrapInstantiationProblem(java.lang.Throwable t,
DeserializationContext ctxt) |
_parseBoolean, _parseBooleanFromNumber, _parseBooleanPrimitive, _parseByte, _parseDate, _parseDouble, _parseDoublePrimitive, _parseFloat, _parseFloatPrimitive, _parseInteger, _parseIntPrimitive, _parseLong, _parseLongPrimitive, _parseShort, _parseShortPrimitive, _parseString, findConvertingContentDeserializer, findDeserializer, getValueClass, isDefaultDeserializer, isDefaultKeyDeserializer, parseDoubledeserialize, deserialize, getDelegatee, getEmptyValue, getNullValue, replaceDelegateeprotected final JavaType _beanType
protected final com.fasterxml.jackson.annotation.JsonFormat.Shape _serializationShape
protected final ValueInstantiator _valueInstantiator
protected JsonDeserializer<java.lang.Object> _delegateDeserializer
protected PropertyBasedCreator _propertyBasedCreator
protected boolean _nonStandardCreation
protected boolean _vanillaProcessing
protected final BeanPropertyMap _beanProperties
protected final ValueInjector[] _injectables
ValueInjectors, if any injectable values are
expected by the bean; otherwise null.
This includes injectors used for injecting values via setters
and fields, but not ones passed through constructor parameters.protected SettableAnyProperty _anySetter
protected final java.util.HashSet<java.lang.String> _ignorableProps
protected final boolean _ignoreAllUnknown
protected final boolean _needViewProcesing
protected final java.util.Map<java.lang.String,SettableBeanProperty> _backRefs
protected transient java.util.HashMap<ClassKey,JsonDeserializer<java.lang.Object>> _subDeserializers
protected UnwrappedPropertyHandler _unwrappedPropertyHandler
protected ExternalTypeHandler _externalTypeIdHandler
protected final ObjectIdReader _objectIdReader
protected BeanDeserializerBase(BeanDeserializerBuilder builder, BeanDescription beanDesc, BeanPropertyMap properties, java.util.Map<java.lang.String,SettableBeanProperty> backRefs, java.util.HashSet<java.lang.String> ignorableProps, boolean ignoreAllUnknown, boolean hasViews)
BeanDeserializerBuilder that
contains configuration.protected BeanDeserializerBase(BeanDeserializerBase src)
protected BeanDeserializerBase(BeanDeserializerBase src, boolean ignoreAllUnknown)
protected BeanDeserializerBase(BeanDeserializerBase src, NameTransformer unwrapper)
public BeanDeserializerBase(BeanDeserializerBase src, ObjectIdReader oir)
public BeanDeserializerBase(BeanDeserializerBase src, java.util.HashSet<java.lang.String> ignorableProps)
public abstract JsonDeserializer<java.lang.Object> unwrappingDeserializer(NameTransformer unwrapper)
JsonDeserializerDefault implementation just returns 'this' indicating that no unwrapped variant exists
unwrappingDeserializer in class JsonDeserializer<java.lang.Object>public abstract BeanDeserializerBase withObjectIdReader(ObjectIdReader oir)
public abstract BeanDeserializerBase withIgnorableProperties(java.util.HashSet<java.lang.String> ignorableProps)
protected abstract BeanDeserializerBase asArrayDeserializer()
public void resolve(DeserializationContext ctxt) throws JsonMappingException
resolve in interface ResolvableDeserializerctxt - Context to use for accessing configuration, resolving
secondary deserializersJsonMappingExceptionprotected JsonDeserializer<java.lang.Object> findConvertingDeserializer(DeserializationContext ctxt, SettableBeanProperty prop) throws JsonMappingException
JsonMappingExceptionpublic JsonDeserializer<?> createContextual(DeserializationContext ctxt, BeanProperty property) throws JsonMappingException
createContextual in interface ContextualDeserializerctxt - Deserialization context to access configuration, additional
deserializers that may be needed by this deserializerproperty - Method, field or constructor parameter that represents the property
(and is used to assign deserialized value).
Should be available; but there may be cases where caller can not provide it and
null is passed instead (in which case impls usually pass 'this' deserializer as is)JsonMappingExceptionprotected SettableBeanProperty _resolveManagedReferenceProperty(DeserializationContext ctxt, SettableBeanProperty prop)
protected SettableBeanProperty _resolveUnwrappedProperty(DeserializationContext ctxt, SettableBeanProperty prop)
protected SettableBeanProperty _resolveInnerClassValuedProperty(DeserializationContext ctxt, SettableBeanProperty prop)
public boolean isCachable()
JsonDeserializer
Note that cached instances are still resolved on per-property basis,
if instance implements ResolvableDeserializer:
cached instance is just as the base. This means that in most cases it is safe to
cache instances; however, it only makes sense to cache instances
if instantiation is expensive, or if instances are heavy-weight.
Default implementation returns false, to indicate that no caching is done.
isCachable in class JsonDeserializer<java.lang.Object>public ObjectIdReader getObjectIdReader()
getObjectIdReader in class JsonDeserializer<java.lang.Object>public boolean hasProperty(java.lang.String propertyName)
public boolean hasViews()
public int getPropertyCount()
public java.util.Collection<java.lang.Object> getKnownPropertyNames()
JsonDeserializertoString will give external property
name.
This is only to be used for error reporting and diagnostics
purposes (most commonly, to accompany "unknown property"
exception).getKnownPropertyNames in class JsonDeserializer<java.lang.Object>public final java.lang.Class<?> getBeanClass()
public JavaType getValueType()
StdDeserializerDefault implementation just returns null.
getValueType in class StdDeserializer<java.lang.Object>public java.util.Iterator<SettableBeanProperty> properties()
creatorProperties()public java.util.Iterator<SettableBeanProperty> creatorProperties()
public SettableBeanProperty findProperty(java.lang.String propertyName)
public SettableBeanProperty findBackReference(java.lang.String logicalName)
BeanDeserializerFactory to properly link
managed- and back-reference pairs.public ValueInstantiator getValueInstantiator()
public void replaceProperty(SettableBeanProperty original, SettableBeanProperty replacement)
NOTE: only ever use this method if you know what you are doing; incorrect usage can break deserializer.
original - Property to replacereplacement - Property to replace it withpublic abstract java.lang.Object deserializeFromObject(com.fasterxml.jackson.core.JsonParser jp,
DeserializationContext ctxt)
throws java.io.IOException,
com.fasterxml.jackson.core.JsonProcessingException
java.io.IOExceptioncom.fasterxml.jackson.core.JsonProcessingExceptionpublic final java.lang.Object deserializeWithType(com.fasterxml.jackson.core.JsonParser jp,
DeserializationContext ctxt,
TypeDeserializer typeDeserializer)
throws java.io.IOException,
com.fasterxml.jackson.core.JsonProcessingException
StdDeserializerdeserializeWithType in class StdDeserializer<java.lang.Object>typeDeserializer - Deserializer to use for handling type informationjava.io.IOExceptioncom.fasterxml.jackson.core.JsonProcessingExceptionprotected java.lang.Object deserializeWithObjectId(com.fasterxml.jackson.core.JsonParser jp,
DeserializationContext ctxt)
throws java.io.IOException,
com.fasterxml.jackson.core.JsonProcessingException
java.io.IOExceptioncom.fasterxml.jackson.core.JsonProcessingExceptionprotected java.lang.Object deserializeFromObjectId(com.fasterxml.jackson.core.JsonParser jp,
DeserializationContext ctxt)
throws java.io.IOException,
com.fasterxml.jackson.core.JsonProcessingException
java.io.IOExceptioncom.fasterxml.jackson.core.JsonProcessingExceptionprotected java.lang.Object deserializeFromObjectUsingNonDefault(com.fasterxml.jackson.core.JsonParser jp,
DeserializationContext ctxt)
throws java.io.IOException,
com.fasterxml.jackson.core.JsonProcessingException
java.io.IOExceptioncom.fasterxml.jackson.core.JsonProcessingExceptionprotected abstract java.lang.Object _deserializeUsingPropertyBased(com.fasterxml.jackson.core.JsonParser jp,
DeserializationContext ctxt)
throws java.io.IOException,
com.fasterxml.jackson.core.JsonProcessingException
java.io.IOExceptioncom.fasterxml.jackson.core.JsonProcessingExceptionpublic java.lang.Object deserializeFromNumber(com.fasterxml.jackson.core.JsonParser jp,
DeserializationContext ctxt)
throws java.io.IOException,
com.fasterxml.jackson.core.JsonProcessingException
java.io.IOExceptioncom.fasterxml.jackson.core.JsonProcessingExceptionpublic java.lang.Object deserializeFromString(com.fasterxml.jackson.core.JsonParser jp,
DeserializationContext ctxt)
throws java.io.IOException,
com.fasterxml.jackson.core.JsonProcessingException
java.io.IOExceptioncom.fasterxml.jackson.core.JsonProcessingExceptionpublic java.lang.Object deserializeFromDouble(com.fasterxml.jackson.core.JsonParser jp,
DeserializationContext ctxt)
throws java.io.IOException,
com.fasterxml.jackson.core.JsonProcessingException
java.io.IOExceptioncom.fasterxml.jackson.core.JsonProcessingExceptionpublic java.lang.Object deserializeFromBoolean(com.fasterxml.jackson.core.JsonParser jp,
DeserializationContext ctxt)
throws java.io.IOException,
com.fasterxml.jackson.core.JsonProcessingException
java.io.IOExceptioncom.fasterxml.jackson.core.JsonProcessingExceptionpublic java.lang.Object deserializeFromArray(com.fasterxml.jackson.core.JsonParser jp,
DeserializationContext ctxt)
throws java.io.IOException,
com.fasterxml.jackson.core.JsonProcessingException
java.io.IOExceptioncom.fasterxml.jackson.core.JsonProcessingExceptionprotected void injectValues(DeserializationContext ctxt, java.lang.Object bean) throws java.io.IOException, com.fasterxml.jackson.core.JsonProcessingException
java.io.IOExceptioncom.fasterxml.jackson.core.JsonProcessingExceptionprotected void handleUnknownProperty(com.fasterxml.jackson.core.JsonParser jp,
DeserializationContext ctxt,
java.lang.Object beanOrClass,
java.lang.String propName)
throws java.io.IOException,
com.fasterxml.jackson.core.JsonProcessingException
handleUnknownProperty in class StdDeserializer<java.lang.Object>jp - Parser that points to value of the unknown propertyctxt - Context for deserialization; allows access to the parser,
error reporting functionalitybeanOrClass - Instance that is being populated by this
deserializer, or if not known, Class that would be instantiated.
If null, will assume type is what StdDeserializer.getValueClass() returns.propName - Name of the property that can not be mappedjava.io.IOExceptioncom.fasterxml.jackson.core.JsonProcessingExceptionprotected java.lang.Object handleUnknownProperties(DeserializationContext ctxt, java.lang.Object bean, TokenBuffer unknownTokens) throws java.io.IOException, com.fasterxml.jackson.core.JsonProcessingException
TokenBuffer
(as field entries, name and value).java.io.IOExceptioncom.fasterxml.jackson.core.JsonProcessingExceptionprotected void handleUnknownVanilla(com.fasterxml.jackson.core.JsonParser jp,
DeserializationContext ctxt,
java.lang.Object bean,
java.lang.String propName)
throws java.io.IOException,
com.fasterxml.jackson.core.JsonProcessingException
java.io.IOExceptioncom.fasterxml.jackson.core.JsonProcessingExceptionprotected java.lang.Object handlePolymorphic(com.fasterxml.jackson.core.JsonParser jp,
DeserializationContext ctxt,
java.lang.Object bean,
TokenBuffer unknownTokens)
throws java.io.IOException,
com.fasterxml.jackson.core.JsonProcessingException
jp - (optional) If not null, parser that has more properties to handle
(in addition to buffered properties); if null, all properties are passed
in bufferjava.io.IOExceptioncom.fasterxml.jackson.core.JsonProcessingExceptionprotected JsonDeserializer<java.lang.Object> _findSubclassDeserializer(DeserializationContext ctxt, java.lang.Object bean, TokenBuffer unknownTokens) throws java.io.IOException, com.fasterxml.jackson.core.JsonProcessingException
java.io.IOExceptioncom.fasterxml.jackson.core.JsonProcessingExceptionpublic void wrapAndThrow(java.lang.Throwable t,
java.lang.Object bean,
java.lang.String fieldName,
DeserializationContext ctxt)
throws java.io.IOException
IOException, or an unchecked exception.
Rules for wrapping and unwrapping are bit complicated; essentially:
JsonMappingException are to be passed as is
java.io.IOExceptionpublic void wrapAndThrow(java.lang.Throwable t,
java.lang.Object bean,
int index,
DeserializationContext ctxt)
throws java.io.IOException
java.io.IOExceptionprotected void wrapInstantiationProblem(java.lang.Throwable t,
DeserializationContext ctxt)
throws java.io.IOException
java.io.IOExceptionCopyright © 2013. All Rights Reserved.