com.fasterxml.jackson.databind.deser
Class BeanDeserializerModifier

java.lang.Object
  extended by com.fasterxml.jackson.databind.deser.BeanDeserializerModifier

public abstract class BeanDeserializerModifier
extends Object

Abstract class that defines API for objects that can be registered (for BeanDeserializerFactory to participate in constructing BeanDeserializer instances. This is typically done by modules that want alter some aspects of deserialization process; and is preferable to sub-classing of BeanDeserializerFactory.

Sequence in which callback methods are called is as follows:

  • updateProperties(com.fasterxml.jackson.databind.DeserializationConfig, com.fasterxml.jackson.databind.BeanDescription, java.util.List) is called once all property definitions are collected, and initial filtering (by ignorable type and explicit ignoral-by-bean) has been performed.
  • updateBuilder(com.fasterxml.jackson.databind.DeserializationConfig, com.fasterxml.jackson.databind.BeanDescription, com.fasterxml.jackson.databind.deser.BeanDeserializerBuilder) is called once all initial pieces for building deserializer have been collected
  • modifyDeserializer(com.fasterxml.jackson.databind.DeserializationConfig, com.fasterxml.jackson.databind.BeanDescription, com.fasterxml.jackson.databind.JsonDeserializer) is called after deserializer has been built by BeanDeserializerBuilder but before it is returned to be used
  • Default method implementations are "no-op"s, meaning that methods are implemented but have no effect; this is mostly so that new methods can be added in later versions.


    Constructor Summary
    BeanDeserializerModifier()
               
     
    Method Summary
     JsonDeserializer<?> modifyDeserializer(DeserializationConfig config, BeanDescription beanDesc, JsonDeserializer<?> deserializer)
              Method called by BeanDeserializerFactory after constructing default bean deserializer instance with properties collected and ordered earlier.
     BeanDeserializerBuilder updateBuilder(DeserializationConfig config, BeanDescription beanDesc, BeanDeserializerBuilder builder)
              Method called by BeanDeserializerFactory when it has collected basic information such as tentative list of properties to deserialize.
     List<BeanPropertyDefinition> updateProperties(DeserializationConfig config, BeanDescription beanDesc, List<BeanPropertyDefinition> propDefs)
              Method called by BeanDeserializerFactory when it has collected initial list of BeanPropertyDefinitions, and done basic by-name and by-type filtering, but before constructing builder or actual property handlers; or arranging order.
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Constructor Detail

    BeanDeserializerModifier

    public BeanDeserializerModifier()
    Method Detail

    updateProperties

    public List<BeanPropertyDefinition> updateProperties(DeserializationConfig config,
                                                         BeanDescription beanDesc,
                                                         List<BeanPropertyDefinition> propDefs)
    Method called by BeanDeserializerFactory when it has collected initial list of BeanPropertyDefinitions, and done basic by-name and by-type filtering, but before constructing builder or actual property handlers; or arranging order. The most common changes to make at this point are to completely remove specified properties, or rename then: other modifications are easier to make at later points.


    updateBuilder

    public BeanDeserializerBuilder updateBuilder(DeserializationConfig config,
                                                 BeanDescription beanDesc,
                                                 BeanDeserializerBuilder builder)
    Method called by BeanDeserializerFactory when it has collected basic information such as tentative list of properties to deserialize. Implementations may choose to modify state of builder (to affect deserializer being built), or even completely replace it (if they want to build different kind of deserializer). Typically changes mostly concern set of properties to deserialize.


    modifyDeserializer

    public JsonDeserializer<?> modifyDeserializer(DeserializationConfig config,
                                                  BeanDescription beanDesc,
                                                  JsonDeserializer<?> deserializer)
    Method called by BeanDeserializerFactory after constructing default bean deserializer instance with properties collected and ordered earlier. Implementations can modify or replace given deserializer and return deserializer to use. Note that although initial deserializer being passed is of type BeanDeserializer, modifiers may return deserializers of other types; and this is why implementations must check for type before casting.



    Copyright © 2012 fasterxml.com. All Rights Reserved.