org.codehaus.jackson.map.deser
Class BeanDeserializerBuilder

java.lang.Object
  extended by org.codehaus.jackson.map.deser.BeanDeserializerBuilder

public class BeanDeserializerBuilder
extends Object

Builder class used for aggregating deserialization information about a POJO, in order to build a JsonDeserializer for deserializing intances.

Since:
1.7

Field Summary
protected  SettableAnyProperty _anySetter
          Fallback setter used for handling any properties that are not mapped to regular setters.
protected  HashMap<String,SettableBeanProperty> _backRefProperties
          Back-reference properties this bean contains (if any)
protected  BasicBeanDescription _beanDesc
           
protected  HashSet<String> _ignorableProps
          Set of names of properties that are recognized but are to be ignored for deserialization purposes (meaning no exception is thrown, value is just skipped).
protected  boolean _ignoreAllUnknown
          Flag that can be set to ignore and skip unknown properties.
protected  List<ValueInjector> _injectables
          Value injectors for deserialization
protected  HashMap<String,SettableBeanProperty> _properties
          Properties to deserialize collected so far.
protected  ValueInstantiator _valueInstantiator
          Object that will handle value instantiation for the bean type.
 
Constructor Summary
  BeanDeserializerBuilder(BasicBeanDescription beanDesc)
           
protected BeanDeserializerBuilder(BeanDeserializerBuilder src)
          Copy constructor for sub-classes to use, when constructing custom builder instances
 
Method Summary
 void addBackReferenceProperty(String referenceName, SettableBeanProperty prop)
          Method called to add a property that represents so-called back reference; reference that "points back" to object that has forward reference to currently built bean.
 void addCreatorProperty(BeanPropertyDefinition propDef)
          Method called by deserializer factory, when a "creator property" (something that is passed via constructor- or factory method argument; instead of setter or field).
 void addIgnorable(String propName)
          Method that will add property name as one of properties that can be ignored if not recognized.
 void addInjectable(String propertyName, JavaType propertyType, Annotations contextAnnotations, AnnotatedMember member, Object valueId)
           
 void addOrReplaceProperty(SettableBeanProperty prop, boolean allowOverride)
          Method for adding a new property or replacing a property.
 void addProperty(SettableBeanProperty prop)
          Method to add a property setter.
 JsonDeserializer<?> build(BeanProperty forProperty)
           
 Iterator<SettableBeanProperty> getProperties()
          Method that allows accessing all properties that this builder currently contains.
 ValueInstantiator getValueInstantiator()
           
 boolean hasProperty(String propertyName)
           
 SettableBeanProperty removeProperty(String name)
           
 void setAnySetter(SettableAnyProperty s)
           
 void setIgnoreUnknownProperties(boolean ignore)
           
 void setValueInstantiator(ValueInstantiator inst)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_beanDesc

protected final BasicBeanDescription _beanDesc

_properties

protected final HashMap<String,SettableBeanProperty> _properties
Properties to deserialize collected so far.

Note: since 1.9.1, LinkedHashMap has been used, since preservation of order is actually important for some use cases.


_injectables

protected List<ValueInjector> _injectables
Value injectors for deserialization

Since:
1.9

_backRefProperties

protected HashMap<String,SettableBeanProperty> _backRefProperties
Back-reference properties this bean contains (if any)


_ignorableProps

protected HashSet<String> _ignorableProps
Set of names of properties that are recognized but are to be ignored for deserialization purposes (meaning no exception is thrown, value is just skipped).


_valueInstantiator

protected ValueInstantiator _valueInstantiator
Object that will handle value instantiation for the bean type.

Since:
1.9

_anySetter

protected SettableAnyProperty _anySetter
Fallback setter used for handling any properties that are not mapped to regular setters. If setter is not null, it will be called once for each such property.


_ignoreAllUnknown

protected boolean _ignoreAllUnknown
Flag that can be set to ignore and skip unknown properties. If set, will not throw an exception for unknown properties.

Constructor Detail

BeanDeserializerBuilder

public BeanDeserializerBuilder(BasicBeanDescription beanDesc)

BeanDeserializerBuilder

protected BeanDeserializerBuilder(BeanDeserializerBuilder src)
Copy constructor for sub-classes to use, when constructing custom builder instances

Since:
1.9
Method Detail

addOrReplaceProperty

public void addOrReplaceProperty(SettableBeanProperty prop,
                                 boolean allowOverride)
Method for adding a new property or replacing a property.


addProperty

public void addProperty(SettableBeanProperty prop)
Method to add a property setter. Will ensure that there is no unexpected override; if one is found will throw a IllegalArgumentException.


addBackReferenceProperty

public void addBackReferenceProperty(String referenceName,
                                     SettableBeanProperty prop)
Method called to add a property that represents so-called back reference; reference that "points back" to object that has forward reference to currently built bean.


addInjectable

public void addInjectable(String propertyName,
                          JavaType propertyType,
                          Annotations contextAnnotations,
                          AnnotatedMember member,
                          Object valueId)
Since:
1.9

addIgnorable

public void addIgnorable(String propName)
Method that will add property name as one of properties that can be ignored if not recognized.


addCreatorProperty

public void addCreatorProperty(BeanPropertyDefinition propDef)
Method called by deserializer factory, when a "creator property" (something that is passed via constructor- or factory method argument; instead of setter or field).

Default implementation does not do anything; we may need to revisit this decision if these properties need to be available through accessors. For now, however, we just have to ensure that we don't try to resolve types that masked setter/field has (see [JACKSON-700] for details).

Since:
1.9.2

setAnySetter

public void setAnySetter(SettableAnyProperty s)

setIgnoreUnknownProperties

public void setIgnoreUnknownProperties(boolean ignore)

setValueInstantiator

public void setValueInstantiator(ValueInstantiator inst)
Since:
1.9

getProperties

public Iterator<SettableBeanProperty> getProperties()
Method that allows accessing all properties that this builder currently contains.

Note that properties are returned in order that properties are ordered (explictly, or by rule), which is the serialization order.

Since:
1.8.3

hasProperty

public boolean hasProperty(String propertyName)

removeProperty

public SettableBeanProperty removeProperty(String name)

getValueInstantiator

public ValueInstantiator getValueInstantiator()
Since:
1.9

build

public JsonDeserializer<?> build(BeanProperty forProperty)