CustomDeserializerFactory (Jackson JSON Processor)
Date: 2013-07-14

org.codehaus.jackson.map.deser

## Class CustomDeserializerFactory

- java.lang.Object
- - org.codehaus.jackson.map.DeserializerFactory
  - - org.codehaus.jackson.map.deser.BasicDeserializerFactory
    - - org.codehaus.jackson.map.deser.BeanDeserializerFactory
      - - org.codehaus.jackson.map.deser.CustomDeserializerFactory

- Deprecated.
  Starting with 1.7, functionality of this class has been implemented both in base `SerializerFactory` (see methods like `SerializerFactory.withAdditionalSerializers(Serializers)`) and through new Module API. As such, this class is not the best way to add custom functionality, and will likely be removed from 2.0 release

      @Deprecated
      public class CustomDeserializerFactory
      extends BeanDeserializerFactory

  Deserializer factory implementation that allows for configuring mapping between types and deserializers to use, by using multiple types of overrides. Existing mappings established by `BeanDeserializerFactory` (and its super class, `BasicDeserializerFactory`) are used if no overrides are defined.

  Unlike base deserializer factories, this factory is stateful because of configuration settings. It is thread-safe, however, as long as all configuration as done before using the factory -- a single instance can be shared between providers and mappers.

  Configurations currently available are:

  - Ability to define explicit mappings between simple non-generic classes/interfaces and deserializers to use for deserializing instance of these classes. Mappings are one-to-one (i.e. there is no "generic" variant for handling sub- or super-classes/interfaces).

  The way custom deserializer factory instances are hooked to `ObjectMapper` is usually by constructing an instance of `DeserializerProvider` (most commonly `StdDeserializerProvider`) with custom deserializer factory, and setting `ObjectMapper` to use it.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.codehaus.jackson.map.deser.BeanDeserializerFactory

      `BeanDeserializerFactory.ConfigImpl`

    - ### Nested classes/interfaces inherited from class org.codehaus.jackson.map.DeserializerFactory

      `DeserializerFactory.Config`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected HashMap<ClassKey,JsonDeserializer<Object>>` | `_directClassMappings` Deprecated. Direct mappings that are used for exact class and interface type matches.
    `protected HashMap<ClassKey,Class<?>>` | `_mixInAnnotations` Deprecated. Mapping that defines how to apply mix-in annotations: key is the type to received additional annotations, and value is the type that has annotations to "mix in".

    - ### Fields inherited from class org.codehaus.jackson.map.deser.BeanDeserializerFactory

      `_factoryConfig, instance`

    - ### Fields inherited from class org.codehaus.jackson.map.deser.BasicDeserializerFactory

      `_arrayDeserializers, optionalHandlers`

    - ### Fields inherited from class org.codehaus.jackson.map.DeserializerFactory

      `NO_DESERIALIZERS`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `` | `CustomDeserializerFactory()` Deprecated.
    `protected` | `CustomDeserializerFactory(DeserializerFactory.Config config)` Deprecated.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addMixInAnnotationMapping(Class<?> destinationClass, Class<?> classWithMixIns)` Deprecated. Method to use for adding mix-in annotations that Class `classWithMixIns` contains into class `destinationClass`.
    `<T> void` | `addSpecificMapping(Class<T> forClass, JsonDeserializer<? extends T> deser)` Deprecated. Method used to add a mapping for specific type -- and only that type -- to use specified deserializer.
    `JsonDeserializer<?>` | `createArrayDeserializer(DeserializationConfig config, DeserializerProvider p, ArrayType type, BeanProperty property)` Deprecated. Method called to create (or, for completely immutable deserializers, reuse) a deserializer that can convert JSON content into values of specified Java type.
    `JsonDeserializer<Object>` | `createBeanDeserializer(DeserializationConfig config, DeserializerProvider p, JavaType type, BeanProperty property)` Deprecated. Method that `DeserializerProvider`s call to create a new deserializer for types other than Collections, Maps, arrays and enums.
    `JsonDeserializer<?>` | `createEnumDeserializer(DeserializationConfig config, DeserializerProvider p, JavaType enumType, BeanProperty property)` Deprecated. Factory method for constructing serializers of `Enum` types.
    `DeserializerFactory` | `withConfig(DeserializerFactory.Config config)` Deprecated. Method used by module registration functionality, to construct a new bean deserializer factory with different configuration settings.

    - ### Methods inherited from class org.codehaus.jackson.map.deser.BeanDeserializerFactory

      `_addDeserializerConstructors, _addDeserializerFactoryMethods, _findCustomArrayDeserializer, _findCustomBeanDeserializer, _findCustomCollectionDeserializer, _findCustomCollectionLikeDeserializer, _findCustomEnumDeserializer, _findCustomMapDeserializer, _findCustomMapLikeDeserializer, _findCustomTreeNodeDeserializer, _handleSingleArgumentConstructor, _handleSingleArgumentFactory, _mapAbstractType2, addBeanProps, addInjectables, addReferenceProperties, buildBeanDeserializer, buildThrowableDeserializer, constructAnySetter, constructBeanDeserializerBuilder, constructCreatorProperty, constructDefaultValueInstantiator, constructSettableProperty, constructSettableProperty, constructSetterlessProperty, createKeyDeserializer, findValueInstantiator, getConfig, isIgnorableType, isPotentialBeanType, mapAbstractType, materializeAbstractType`

    - ### Methods inherited from class org.codehaus.jackson.map.deser.BasicDeserializerFactory

      `constructEnumResolver, createCollectionDeserializer, createCollectionLikeDeserializer, createMapDeserializer, createMapLikeDeserializer, createTreeDeserializer, findDeserializerFromAnnotation, findPropertyContentTypeDeserializer, findPropertyTypeDeserializer, findStdBeanDeserializer, findTypeDeserializer, modifyTypeByAnnotation, resolveType`

    - ### Methods inherited from class org.codehaus.jackson.map.DeserializerFactory

      `withAbstractTypeResolver, withAdditionalDeserializers, withAdditionalKeyDeserializers, withDeserializerModifier, withValueInstantiators`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### _directClassMappings

          protected HashMap<ClassKey,JsonDeserializer<Object>> _directClassMappings

      Deprecated.
      Direct mappings that are used for exact class and interface type matches.

    - #### _mixInAnnotations

          protected HashMap<ClassKey,Class<?>> _mixInAnnotations

      Deprecated.
      Mapping that defines how to apply mix-in annotations: key is the type to received additional annotations, and value is the type that has annotations to "mix in".

      Annotations associated with the value classes will be used to override annotations of the key class, associated with the same field or method. They can be further masked by sub-classes: you can think of it as injecting annotations between the target class and its sub-classes (or interfaces)

      Since:
        1.2

  - ### Constructor Detail

    - #### CustomDeserializerFactory

          public CustomDeserializerFactory()

      Deprecated.

    - #### CustomDeserializerFactory

          protected CustomDeserializerFactory(DeserializerFactory.Config config)

      Deprecated.

  - ### Method Detail

    - #### withConfig

          public DeserializerFactory withConfig(DeserializerFactory.Config config)

      Deprecated.
      Description copied from class: `BeanDeserializerFactory`
      Method used by module registration functionality, to construct a new bean deserializer factory with different configuration settings.
      Overrides:
        `withConfig` in class `BeanDeserializerFactory`

    - #### addSpecificMapping

          public <T> void addSpecificMapping(Class<T> forClass,
                                    JsonDeserializer<? extends T> deser)

      Deprecated.
      Method used to add a mapping for specific type -- and only that type -- to use specified deserializer. This means that binding is not used for sub-types.

      Note that both class and interfaces can be mapped, since the type is derived from method declarations; and hence may be abstract types and interfaces. This is different from custom serialization where only class types can be directly mapped.

      Parameters:
        `forClass` - Class to deserialize using specific deserializer.
        `deser` - Deserializer to use for the class. Declared type for deserializer may be more specific (sub-class) than declared class to map, since that will still be compatible (deserializer produces sub-class which is assignable to field/method)

    - #### addMixInAnnotationMapping

          public void addMixInAnnotationMapping(Class<?> destinationClass,
                                       Class<?> classWithMixIns)

      Deprecated.
      Method to use for adding mix-in annotations that Class `classWithMixIns` contains into class `destinationClass`. Mixing in is done when introspecting class annotations and properties. Annotations from `classWithMixIns` (and its supertypes) will override anything `destinationClass` (and its super-types) has already.
      Parameters:
        `destinationClass` - Class to modify by adding annotations
        `classWithMixIns` - Class that contains annotations to add
      Since:
        1.2

    - #### createBeanDeserializer

          public JsonDeserializer<Object> createBeanDeserializer(DeserializationConfig config,
                                                        DeserializerProvider p,
                                                        JavaType type,
                                                        BeanProperty property)
                                                          throws JsonMappingException

      Deprecated.
      Description copied from class: `BeanDeserializerFactory`
      Method that `DeserializerProvider`s call to create a new deserializer for types other than Collections, Maps, arrays and enums.
      Overrides:
        `createBeanDeserializer` in class `BeanDeserializerFactory`
        `p` - Provider that can be called to create deserializers for contained member types
        `type` - Type to be deserialized
      Throws:
        `JsonMappingException`

    - #### createArrayDeserializer

          public JsonDeserializer<?> createArrayDeserializer(DeserializationConfig config,
                                                    DeserializerProvider p,
                                                    ArrayType type,
                                                    BeanProperty property)
                                                      throws JsonMappingException

      Deprecated.
      Description copied from class: `DeserializerFactory`
      Method called to create (or, for completely immutable deserializers, reuse) a deserializer that can convert JSON content into values of specified Java type.
      Overrides:
        `createArrayDeserializer` in class `BasicDeserializerFactory`
        `p` - Provider that can be called to create deserializers for contained member types
        `type` - Type to be deserialized
      Throws:
        `JsonMappingException`

    - #### createEnumDeserializer

          public JsonDeserializer<?> createEnumDeserializer(DeserializationConfig config,
                                                   DeserializerProvider p,
                                                   JavaType enumType,
                                                   BeanProperty property)
                                                     throws JsonMappingException

      Deprecated.
      Description copied from class: `BasicDeserializerFactory`
      Factory method for constructing serializers of `Enum` types.
      Overrides:
        `createEnumDeserializer` in class `BasicDeserializerFactory`
      Throws:
        `JsonMappingException`