public class BeanDeserializer extends StdDeserializer<Object> implements ResolvableDeserializer
StdDeserializer.BigDecimalDeserializer, StdDeserializer.BigIntegerDeserializer, StdDeserializer.BooleanDeserializer, StdDeserializer.ByteDeserializer, StdDeserializer.CharacterDeserializer, StdDeserializer.DoubleDeserializer, StdDeserializer.FloatDeserializer, StdDeserializer.IntegerDeserializer, StdDeserializer.LongDeserializer, StdDeserializer.NumberDeserializer, StdDeserializer.PrimitiveOrWrapperDeserializer<T>, StdDeserializer.ShortDeserializer, StdDeserializer.SqlDateDeserializer, StdDeserializer.StackTraceElementDeserializerJsonDeserializer.None| 限定符和类型 | 字段和说明 |
|---|---|
protected SettableAnyProperty |
_anySetter
Fallback setter used for handling any properties that are not
mapped to regular setters.
|
protected Map<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<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 AnnotatedClass |
_forClass
Class for which deserializer is built; used for accessing
annotations during resolution phase (see
resolve(org.codehaus.jackson.map.DeserializationConfig, org.codehaus.jackson.map.DeserializerProvider)). |
protected HashSet<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 |
_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 BeanProperty |
_property
Property that contains value to be deserialized using
deserializer; mostly needed to find contextual annotations
for subtypes.
|
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 HashMap<ClassKey,JsonDeserializer<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())
|
_valueClass| 限定符 | 构造器和说明 |
|---|---|
|
BeanDeserializer(AnnotatedClass forClass,
JavaType type,
BeanProperty property,
CreatorCollector creators,
BeanPropertyMap properties,
Map<String,SettableBeanProperty> backRefs,
HashSet<String> ignorableProps,
boolean ignoreAllUnknown,
SettableAnyProperty anySetter)
已过时。
(since 1.9) Use the constructor that takes
ValueInstantiator instead |
protected |
BeanDeserializer(AnnotatedClass forClass,
JavaType type,
BeanProperty property,
ValueInstantiator valueInstantiator,
BeanPropertyMap properties,
Map<String,SettableBeanProperty> backRefs,
HashSet<String> ignorableProps,
boolean ignoreAllUnknown,
SettableAnyProperty anySetter,
List<ValueInjector> injectables) |
|
BeanDeserializer(BeanDescription beanDesc,
BeanProperty property,
ValueInstantiator valueInstantiator,
BeanPropertyMap properties,
Map<String,SettableBeanProperty> backRefs,
HashSet<String> ignorableProps,
boolean ignoreAllUnknown,
SettableAnyProperty anySetter,
List<ValueInjector> injectables) |
protected |
BeanDeserializer(BeanDeserializer src)
Copy-constructor that can be used by sub-classes to allow
copy-on-write styling copying of settings of an existing instance.
|
protected |
BeanDeserializer(BeanDeserializer src,
boolean ignoreAllUnknown) |
| 限定符和类型 | 方法和说明 |
|---|---|
protected Object |
_deserializeUsingPropertyBased(JsonParser jp,
DeserializationContext ctxt)
Method called to deserialize bean using "property-based creator":
this means that a non-default constructor or factory method is
called, and then possibly other setters.
|
protected JsonDeserializer<Object> |
_findSubclassDeserializer(DeserializationContext ctxt,
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(DeserializationConfig config,
SettableBeanProperty prop)
Helper method that will handle gruesome details of dealing with properties
that have non-static inner class as value...
|
protected SettableBeanProperty |
_resolveManagedReferenceProperty(DeserializationConfig config,
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(DeserializationConfig config,
SettableBeanProperty prop)
Helper method called to see if given property might be so-called unwrapped
property: these require special handling.
|
Object |
deserialize(JsonParser jp,
DeserializationContext ctxt)
Main deserialization method for bean-based objects (POJOs).
|
Object |
deserialize(JsonParser jp,
DeserializationContext ctxt,
Object bean)
Secondary deserialization method, called in cases where POJO
instance is created as part of deserialization, potentially
after collecting some or all of the properties to set.
|
Object |
deserializeFromArray(JsonParser jp,
DeserializationContext ctxt) |
Object |
deserializeFromBoolean(JsonParser jp,
DeserializationContext ctxt)
Method called to deserialize POJO value from a JSON boolean
value (true, false)
|
Object |
deserializeFromDouble(JsonParser jp,
DeserializationContext ctxt)
Method called to deserialize POJO value from a JSON floating-point
number.
|
Object |
deserializeFromNumber(JsonParser jp,
DeserializationContext ctxt) |
Object |
deserializeFromObject(JsonParser jp,
DeserializationContext ctxt) |
protected Object |
deserializeFromObjectUsingNonDefault(JsonParser jp,
DeserializationContext ctxt) |
Object |
deserializeFromString(JsonParser jp,
DeserializationContext ctxt) |
protected Object |
deserializeUsingPropertyBasedWithExternalTypeId(JsonParser jp,
DeserializationContext ctxt) |
protected Object |
deserializeUsingPropertyBasedWithUnwrapped(JsonParser jp,
DeserializationContext ctxt) |
protected Object |
deserializeWithExternalTypeId(JsonParser jp,
DeserializationContext ctxt) |
protected Object |
deserializeWithExternalTypeId(JsonParser jp,
DeserializationContext ctxt,
Object bean) |
Object |
deserializeWithType(JsonParser jp,
DeserializationContext ctxt,
TypeDeserializer typeDeserializer)
Base implementation that does not assume specific type
inclusion mechanism.
|
protected Object |
deserializeWithUnwrapped(JsonParser jp,
DeserializationContext ctxt)
Method called when there are declared "unwrapped" properties
which need special handling
|
protected Object |
deserializeWithUnwrapped(JsonParser jp,
DeserializationContext ctxt,
Object bean) |
SettableBeanProperty |
findBackReference(String logicalName)
Method needed by
BeanDeserializerFactory to properly link
managed- and back-reference pairs. |
Class<?> |
getBeanClass() |
int |
getPropertyCount()
Accessor for checking number of deserialized properties.
|
ValueInstantiator |
getValueInstantiator() |
JavaType |
getValueType()
Exact structured type deserializer handles, if known.
|
protected Object |
handlePolymorphic(JsonParser jp,
DeserializationContext ctxt,
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 Object |
handleUnknownProperties(DeserializationContext ctxt,
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(JsonParser jp,
DeserializationContext ctxt,
Object beanOrClass,
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.
|
boolean |
hasProperty(String propertyName) |
protected void |
injectValues(DeserializationContext ctxt,
Object bean) |
Iterator<SettableBeanProperty> |
properties() |
void |
resolve(DeserializationConfig config,
DeserializerProvider provider)
Method called to finalize setup of this deserializer,
after deserializer itself has been registered.
|
JsonDeserializer<Object> |
unwrappingDeserializer()
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.
|
void |
wrapAndThrow(Throwable t,
Object bean,
int index)
已过时。
Since 1.7 use variant that takes
DeserializationContext |
void |
wrapAndThrow(Throwable t,
Object bean,
int index,
DeserializationContext ctxt) |
void |
wrapAndThrow(Throwable t,
Object bean,
String fieldName)
已过时。
Since 1.7 use variant that takes
DeserializationContext |
void |
wrapAndThrow(Throwable t,
Object bean,
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(Throwable t,
DeserializationContext ctxt) |
_parseBoolean, _parseBooleanFromNumber, _parseBooleanPrimitive, _parseByte, _parseDate, _parseDouble, _parseDoublePrimitive, _parseFloat, _parseFloatPrimitive, _parseInteger, _parseIntPrimitive, _parseLong, _parseLongPrimitive, _parseShort, _parseShortPrimitive, findDeserializer, getValueClass, isDefaultSerializer, parseDouble, reportUnknownPropertygetEmptyValue, getNullValueprotected final AnnotatedClass _forClass
resolve(org.codehaus.jackson.map.DeserializationConfig, org.codehaus.jackson.map.DeserializerProvider)).protected final JavaType _beanType
protected final BeanProperty _property
protected final ValueInstantiator _valueInstantiator
protected JsonDeserializer<Object> _delegateDeserializer
protected final PropertyBasedCreator _propertyBasedCreator
protected boolean _nonStandardCreation
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 HashSet<String> _ignorableProps
protected final boolean _ignoreAllUnknown
protected final Map<String,SettableBeanProperty> _backRefs
protected HashMap<ClassKey,JsonDeserializer<Object>> _subDeserializers
protected UnwrappedPropertyHandler _unwrappedPropertyHandler
protected ExternalTypeHandler _externalTypeIdHandler
@Deprecated public BeanDeserializer(AnnotatedClass forClass, JavaType type, BeanProperty property, CreatorCollector creators, BeanPropertyMap properties, Map<String,SettableBeanProperty> backRefs, HashSet<String> ignorableProps, boolean ignoreAllUnknown, SettableAnyProperty anySetter)
ValueInstantiator insteadpublic BeanDeserializer(BeanDescription beanDesc, BeanProperty property, ValueInstantiator valueInstantiator, BeanPropertyMap properties, Map<String,SettableBeanProperty> backRefs, HashSet<String> ignorableProps, boolean ignoreAllUnknown, SettableAnyProperty anySetter, List<ValueInjector> injectables)
protected BeanDeserializer(AnnotatedClass forClass, JavaType type, BeanProperty property, ValueInstantiator valueInstantiator, BeanPropertyMap properties, Map<String,SettableBeanProperty> backRefs, HashSet<String> ignorableProps, boolean ignoreAllUnknown, SettableAnyProperty anySetter, List<ValueInjector> injectables)
protected BeanDeserializer(BeanDeserializer src)
protected BeanDeserializer(BeanDeserializer src, boolean ignoreAllUnknown)
public JsonDeserializer<Object> unwrappingDeserializer()
JsonDeserializerDefault implementation just returns 'this' indicating that no unwrapped variant exists
unwrappingDeserializer 在类中 JsonDeserializer<Object>public boolean hasProperty(String propertyName)
public int getPropertyCount()
public final Class<?> getBeanClass()
public JavaType getValueType()
StdDeserializerDefault implementation just returns null.
getValueType 在类中 StdDeserializer<Object>public Iterator<SettableBeanProperty> properties()
public SettableBeanProperty findBackReference(String logicalName)
BeanDeserializerFactory to properly link
managed- and back-reference pairs.public ValueInstantiator getValueInstantiator()
public void resolve(DeserializationConfig config, DeserializerProvider provider) throws JsonMappingException
resolve 在接口中 ResolvableDeserializerprovider - Provider that has constructed deserializer this method
is called on.JsonMappingExceptionprotected SettableBeanProperty _resolveManagedReferenceProperty(DeserializationConfig config, SettableBeanProperty prop)
protected SettableBeanProperty _resolveUnwrappedProperty(DeserializationConfig config, SettableBeanProperty prop)
protected SettableBeanProperty _resolveInnerClassValuedProperty(DeserializationConfig config, SettableBeanProperty prop)
public final Object deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException
deserialize 在类中 JsonDeserializer<Object>jp - Parsed used for reading JSON contentctxt - Context that can be used to access information about
this deserialization activity.IOExceptionJsonProcessingExceptionpublic Object deserialize(JsonParser jp, DeserializationContext ctxt, Object bean) throws IOException, JsonProcessingException
deserialize 在类中 JsonDeserializer<Object>IOExceptionJsonProcessingExceptionpublic Object deserializeWithType(JsonParser jp, DeserializationContext ctxt, TypeDeserializer typeDeserializer) throws IOException, JsonProcessingException
StdDeserializerdeserializeWithType 在类中 StdDeserializer<Object>typeDeserializer - Deserializer to use for handling type informationIOExceptionJsonProcessingExceptionpublic Object deserializeFromObject(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException
protected Object deserializeFromObjectUsingNonDefault(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException
IOExceptionJsonProcessingExceptionpublic Object deserializeFromString(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException
public Object deserializeFromNumber(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException
public Object deserializeFromDouble(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException
IOExceptionJsonProcessingExceptionpublic Object deserializeFromBoolean(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException
IOExceptionJsonProcessingExceptionpublic Object deserializeFromArray(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException
IOExceptionJsonProcessingExceptionprotected final Object _deserializeUsingPropertyBased(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException
IOExceptionJsonProcessingExceptionprotected Object handlePolymorphic(JsonParser jp, DeserializationContext ctxt, Object bean, TokenBuffer unknownTokens) throws IOException, 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 bufferIOExceptionJsonProcessingExceptionprotected Object deserializeWithUnwrapped(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException
protected Object deserializeWithUnwrapped(JsonParser jp, DeserializationContext ctxt, Object bean) throws IOException, JsonProcessingException
protected Object deserializeUsingPropertyBasedWithUnwrapped(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException
protected Object deserializeWithExternalTypeId(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException
protected Object deserializeWithExternalTypeId(JsonParser jp, DeserializationContext ctxt, Object bean) throws IOException, JsonProcessingException
protected Object deserializeUsingPropertyBasedWithExternalTypeId(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException
protected void injectValues(DeserializationContext ctxt, Object bean) throws IOException, JsonProcessingException
protected void handleUnknownProperty(JsonParser jp, DeserializationContext ctxt, Object beanOrClass, String propName) throws IOException, JsonProcessingException
handleUnknownProperty 在类中 StdDeserializer<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 mappedIOExceptionJsonProcessingExceptionprotected Object handleUnknownProperties(DeserializationContext ctxt, Object bean, TokenBuffer unknownTokens) throws IOException, JsonProcessingException
TokenBuffer
(as field entries, name and value).protected JsonDeserializer<Object> _findSubclassDeserializer(DeserializationContext ctxt, Object bean, TokenBuffer unknownTokens) throws IOException, JsonProcessingException
public void wrapAndThrow(Throwable t, Object bean, String fieldName, DeserializationContext ctxt) throws IOException
IOException, or an unchecked exception.
Rules for wrapping and unwrapping are bit complicated; essentially:
JsonMappingException are to be passed as is
IOExceptionpublic void wrapAndThrow(Throwable t, Object bean, int index, DeserializationContext ctxt) throws IOException
IOExceptionprotected void wrapInstantiationProblem(Throwable t, DeserializationContext ctxt) throws IOException
IOException@Deprecated public void wrapAndThrow(Throwable t, Object bean, String fieldName) throws IOException
DeserializationContextIOException@Deprecated public void wrapAndThrow(Throwable t, Object bean, int index) throws IOException
DeserializationContextIOException