|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.codehaus.jackson.map.JsonDeserializer<T>
org.codehaus.jackson.map.deser.StdDeserializer<Object>
org.codehaus.jackson.map.deser.BeanDeserializer
public class BeanDeserializer
Deserializer class that can deserialize instances of arbitrary bean objects, usually from Json Object structs, but possibly also from simple types like String values.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.codehaus.jackson.map.JsonDeserializer |
---|
JsonDeserializer.None |
Field Summary | |
---|---|
protected SettableAnyProperty |
_anySetter
Fallback setter used for handling any properties that are not mapped to regular setters. |
protected JavaType |
_beanType
|
protected Constructor<?> |
_defaultConstructor
Default constructor used to instantiate the bean when mapping from Json object, and only using setters for initialization (not specific constructors). |
protected org.codehaus.jackson.map.deser.Creator.Delegating |
_delegatingCreator
If the bean class can be instantiated using a creator (an annotated single arg constructor or static method), this object is used for handling details of how delegate-based deserialization and instance construction works |
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 org.codehaus.jackson.map.deser.Creator.NumberBased |
_numberCreator
If the "bean" class can be instantiated using just a single numeric (int, long) value (via constructor, static method etc), this object knows how to invoke method/constructor in question. |
protected org.codehaus.jackson.map.deser.Creator.PropertyBased |
_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<String,SettableBeanProperty> |
_props
Things set via setters (modifiers) are included in this Map. |
protected org.codehaus.jackson.map.deser.Creator.StringBased |
_stringCreator
If the "bean" class can be instantiated using just a single String (via constructor, static method etc), this object knows how to invoke method/constructor in question. |
protected HashMap<ClassKey,JsonDeserializer<Object>> |
_subDeserializers
Lazily constructed map used to contain deserializers needed for polymorphic subtypes. |
Fields inherited from class org.codehaus.jackson.map.deser.StdDeserializer |
---|
_valueClass |
Constructor Summary | |
---|---|
BeanDeserializer(JavaType type)
|
Method Summary | |
---|---|
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. |
void |
addIgnorable(String propName)
Method that will add property name as one of properties that can be ignored if not recognized. |
void |
addProperty(SettableBeanProperty prop)
Method to add a property setter. |
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 |
deserializeFromNumber(JsonParser jp,
DeserializationContext ctxt)
|
Object |
deserializeFromObject(JsonParser jp,
DeserializationContext ctxt)
|
Object |
deserializeFromString(JsonParser jp,
DeserializationContext ctxt)
|
Object |
deserializeUsingCreator(JsonParser jp,
DeserializationContext ctxt)
|
Object |
deserializeWithType(JsonParser jp,
DeserializationContext ctxt,
TypeDeserializer typeDeserializer)
Base implementation that does not assume specific type inclusion mechanism. |
Class<?> |
getBeanClass()
|
JavaType |
getValueType()
Exact structured type deserializer handles, if known; null for non-structured (scalar) types. |
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. |
SettableBeanProperty |
removeProperty(String name)
|
void |
resolve(DeserializationConfig config,
DeserializerProvider provider)
Method called to finalize setup of this deserializer, after deserializer itself has been registered. |
void |
setAnySetter(SettableAnyProperty s)
|
void |
setCreators(CreatorContainer creators)
Method called by factory after it has introspected all available Creators (constructors, static factory methods). |
void |
setDefaultConstructor(Constructor<?> ctor)
|
void |
setIgnoreUnknownProperties(boolean ignore)
|
Methods inherited from class org.codehaus.jackson.map.deser.StdDeserializer |
---|
_parseBoolean, _parseDate, _parseDouble, _parseFloat, _parseInt, _parseLong, _parseShort, findDeserializer, getValueClass, reportUnknownProperty |
Methods inherited from class org.codehaus.jackson.map.JsonDeserializer |
---|
getNullValue |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final JavaType _beanType
protected Constructor<?> _defaultConstructor
Note: may be null, if deserializer is constructed for abstract types (which is only useful if additional type information will allow construction of concrete subtype).
protected org.codehaus.jackson.map.deser.Creator.StringBased _stringCreator
protected org.codehaus.jackson.map.deser.Creator.NumberBased _numberCreator
protected org.codehaus.jackson.map.deser.Creator.Delegating _delegatingCreator
protected org.codehaus.jackson.map.deser.Creator.PropertyBased _propertyBasedCreator
protected final HashMap<String,SettableBeanProperty> _props
protected SettableAnyProperty _anySetter
protected HashSet<String> _ignorableProps
protected boolean _ignoreAllUnknown
protected HashMap<ClassKey,JsonDeserializer<Object>> _subDeserializers
Constructor Detail |
---|
public BeanDeserializer(JavaType type)
Method Detail |
---|
public void setDefaultConstructor(Constructor<?> ctor)
public void setCreators(CreatorContainer creators)
public void addProperty(SettableBeanProperty prop)
IllegalArgumentException
.
public SettableBeanProperty removeProperty(String name)
public void setAnySetter(SettableAnyProperty s)
public void setIgnoreUnknownProperties(boolean ignore)
public void addIgnorable(String propName)
public void resolve(DeserializationConfig config, DeserializerProvider provider) throws JsonMappingException
resolve
in interface ResolvableDeserializer
provider
- Provider that has constructed deserializer this method
is called on.
JsonMappingException
public final Object deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException
deserialize
in class JsonDeserializer<Object>
jp
- Parsed used for reading Json contentctxt
- Context that can be used to access information about
this deserialization activity.
IOException
JsonProcessingException
public Object deserialize(JsonParser jp, DeserializationContext ctxt, Object bean) throws IOException, JsonProcessingException
deserialize
in class JsonDeserializer<Object>
IOException
JsonProcessingException
public Object deserializeWithType(JsonParser jp, DeserializationContext ctxt, TypeDeserializer typeDeserializer) throws IOException, JsonProcessingException
StdDeserializer
deserializeWithType
in class StdDeserializer<Object>
typeDeserializer
- Deserializer to use for handling type information
IOException
JsonProcessingException
public final Class<?> getBeanClass()
public JavaType getValueType()
StdDeserializer
Default implementation just returns null.
getValueType
in class StdDeserializer<Object>
public Object deserializeFromObject(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException
IOException
JsonProcessingException
public Object deserializeFromString(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException
IOException
JsonProcessingException
public Object deserializeFromNumber(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException
IOException
JsonProcessingException
public Object deserializeUsingCreator(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException
IOException
JsonProcessingException
protected final Object _deserializeUsingPropertyBased(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException
IOException
JsonProcessingException
protected void handleUnknownProperty(JsonParser jp, DeserializationContext ctxt, Object beanOrClass, String propName) throws IOException, JsonProcessingException
handleUnknownProperty
in class 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 mapped
IOException
JsonProcessingException
protected Object handleUnknownProperties(DeserializationContext ctxt, Object bean, TokenBuffer unknownTokens) throws IOException, JsonProcessingException
TokenBuffer
(as field entries, name and value).
IOException
JsonProcessingException
protected 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 buffer
IOException
JsonProcessingException
protected JsonDeserializer<Object> _findSubclassDeserializer(DeserializationContext ctxt, Object bean, TokenBuffer unknownTokens) throws IOException, JsonProcessingException
IOException
JsonProcessingException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |