org.codehaus.jackson.map.deser
Class BeanDeserializerFactory

java.lang.Object
  extended by org.codehaus.jackson.map.DeserializerFactory
      extended by org.codehaus.jackson.map.deser.BasicDeserializerFactory
          extended by org.codehaus.jackson.map.deser.BeanDeserializerFactory
Direct Known Subclasses:
CustomDeserializerFactory

public class BeanDeserializerFactory
extends BasicDeserializerFactory

Concrete deserializer factory class that adds full Bean deserializer construction logic using class introspection.

Since there is no caching, this factory is stateless and a globally shared singleton instance (instance) can be used by DeserializerProviders).


Field Summary
static BeanDeserializerFactory instance
           
 
Constructor Summary
protected BeanDeserializerFactory()
          We will provide default constructor to allow sub-classing, but make it protected so that no non-singleton instances of the class will be instantiated.
 
Method Summary
protected  void addBeanProps(DeserializationConfig config, BasicBeanDescription beanDesc, BeanDeserializer deser)
          Method called to figure out settable properties for the deserializer.
protected  void addDeserializerConstructors(DeserializationConfig config, BasicBeanDescription beanDesc, BeanDeserializer deser)
           
 JsonDeserializer<java.lang.Object> buildBeanDeserializer(DeserializationConfig config, JavaType type, BasicBeanDescription beanDesc)
          Method that is to actually build a bean deserializer instance.
 JsonDeserializer<java.lang.Object> buildThrowableDeserializer(DeserializationConfig config, JavaType type, BasicBeanDescription beanDesc)
           
protected  SettableAnyProperty constructAnySetter(DeserializationConfig config, AnnotatedMethod am)
          Method called to construct fallback SettableAnyProperty for handling unknown bean properties, given a method that has been designated as such setter.
protected  BeanDeserializer constructBeanDeserializerInstance(DeserializationConfig config, JavaType type, BasicBeanDescription beanDesc)
          Method for construcing "empty" deserializer: overridable to allow sub-classing of BeanDeserializer.
protected  SettableBeanProperty constructSettableProperty(DeserializationConfig config, java.lang.String name, AnnotatedMethod setter)
          Method that will construct a regular bean property setter using the given setter method.
protected  SettableBeanProperty constructSetterlessProperty(DeserializationConfig config, java.lang.String name, AnnotatedMethod getter)
          Method that will construct a regular bean property setter using the given setter method.
protected  ThrowableDeserializer constructThrowableDeserializerInstance(DeserializationConfig config, JavaType type, BasicBeanDescription beanDesc)
           
 JsonDeserializer<java.lang.Object> createBeanDeserializer(DeserializationConfig config, JavaType type, DeserializerProvider p)
          Method that DeserializerProviders call to create a new deserializer for types other than Collections, Maps, arrays and enums.
protected  boolean isPotentialBeanType(java.lang.Class<?> type)
          Helper method used to skip processing for types that we know can not be (i.e.
 
Methods inherited from class org.codehaus.jackson.map.deser.BasicDeserializerFactory
createArrayDeserializer, createCollectionDeserializer, createEnumDeserializer, createMapDeserializer, createTreeDeserializer, findDeserializerFromAnnotation, modifyTypeByAnnotation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instance

public static final BeanDeserializerFactory instance
Constructor Detail

BeanDeserializerFactory

protected BeanDeserializerFactory()
We will provide default constructor to allow sub-classing, but make it protected so that no non-singleton instances of the class will be instantiated.

Method Detail

createBeanDeserializer

public JsonDeserializer<java.lang.Object> createBeanDeserializer(DeserializationConfig config,
                                                                 JavaType type,
                                                                 DeserializerProvider p)
                                                          throws JsonMappingException
Method that DeserializerProviders call to create a new deserializer for types other than Collections, Maps, arrays and enums.

Overrides:
createBeanDeserializer in class BasicDeserializerFactory
type - Type to be deserialized
p - Provider that can be called to create deserializers for contained member types
Throws:
JsonMappingException

buildBeanDeserializer

public JsonDeserializer<java.lang.Object> buildBeanDeserializer(DeserializationConfig config,
                                                                JavaType type,
                                                                BasicBeanDescription beanDesc)
                                                         throws JsonMappingException
Method that is to actually build a bean deserializer instance. All basic sanity checks have been done to know that what we have may be a valid bean type, and that there are no default simple deserializers.

Throws:
JsonMappingException

buildThrowableDeserializer

public JsonDeserializer<java.lang.Object> buildThrowableDeserializer(DeserializationConfig config,
                                                                     JavaType type,
                                                                     BasicBeanDescription beanDesc)
                                                              throws JsonMappingException
Throws:
JsonMappingException

constructBeanDeserializerInstance

protected BeanDeserializer constructBeanDeserializerInstance(DeserializationConfig config,
                                                             JavaType type,
                                                             BasicBeanDescription beanDesc)
Method for construcing "empty" deserializer: overridable to allow sub-classing of BeanDeserializer.


constructThrowableDeserializerInstance

protected ThrowableDeserializer constructThrowableDeserializerInstance(DeserializationConfig config,
                                                                       JavaType type,
                                                                       BasicBeanDescription beanDesc)

addDeserializerConstructors

protected void addDeserializerConstructors(DeserializationConfig config,
                                           BasicBeanDescription beanDesc,
                                           BeanDeserializer deser)

addBeanProps

protected void addBeanProps(DeserializationConfig config,
                            BasicBeanDescription beanDesc,
                            BeanDeserializer deser)
                     throws JsonMappingException
Method called to figure out settable properties for the deserializer.

Throws:
JsonMappingException

constructAnySetter

protected SettableAnyProperty constructAnySetter(DeserializationConfig config,
                                                 AnnotatedMethod am)
                                          throws JsonMappingException
Method called to construct fallback SettableAnyProperty for handling unknown bean properties, given a method that has been designated as such setter.

Throws:
JsonMappingException

constructSettableProperty

protected SettableBeanProperty constructSettableProperty(DeserializationConfig config,
                                                         java.lang.String name,
                                                         AnnotatedMethod setter)
                                                  throws JsonMappingException
Method that will construct a regular bean property setter using the given setter method.

Parameters:
setter - Method to use to set property value; or null if none. Null only for "setterless" properties
Returns:
Property constructed, if any; or null to indicate that there should be no property based on given definitions.
Throws:
JsonMappingException

constructSetterlessProperty

protected SettableBeanProperty constructSetterlessProperty(DeserializationConfig config,
                                                           java.lang.String name,
                                                           AnnotatedMethod getter)
                                                    throws JsonMappingException
Method that will construct a regular bean property setter using the given setter method.

Parameters:
getter - Method to use to get property value to modify, null if none. Non-null for "setterless" properties.
Throws:
JsonMappingException

isPotentialBeanType

protected boolean isPotentialBeanType(java.lang.Class<?> type)
Helper method used to skip processing for types that we know can not be (i.e. are never consider to be) beans: things like primitives, Arrays, Enums, and proxy types.

Note that usually we shouldn't really be getting these sort of types anyway; but better safe than sorry.