org.codehaus.jackson.map
Class DeserializerProvider

java.lang.Object
  extended by org.codehaus.jackson.map.DeserializerProvider
Direct Known Subclasses:
StdDeserializerProvider

public abstract class DeserializerProvider
extends Object

Abstract class that defines API used by ObjectMapper and JsonDeserializers to obtain deserializers capable of re-constructing instances of handled type from JSON content.


Constructor Summary
protected DeserializerProvider()
           
 
Method Summary
abstract  int cachedDeserializersCount()
          Method that can be used to determine how many deserializers this provider is caching currently (if it does caching: default implementation does) Exact count depends on what kind of deserializers get cached; default implementation caches only dynamically constructed deserializers, but not eagerly constructed standard deserializers (which is different from how serializer provider works).
 KeyDeserializer findKeyDeserializer(DeserializationConfig config, JavaType keyType)
          Deprecated. As of version 1.7, use version that exposes context class and property, instead of just types
abstract  KeyDeserializer findKeyDeserializer(DeserializationConfig config, JavaType keyType, BeanProperty property)
          Method called to get hold of a deserializer to use for deserializing keys for Map.
 JsonDeserializer<Object> findTypedValueDeserializer(DeserializationConfig config, JavaType type)
          Deprecated. As of version 1.7, use version that exposes context class and property, instead of just types
abstract  JsonDeserializer<Object> findTypedValueDeserializer(DeserializationConfig config, JavaType type, BeanProperty property)
          Method called to locate deserializer for given type, as well as matching type deserializer (if one is needed); and if type deserializer is needed, construct a "wrapped" deserializer that can extract and use type information for calling actual deserializer.
abstract  JsonDeserializer<Object> findValueDeserializer(DeserializationConfig config, JavaType propertyType, BeanProperty property)
          Method called to get hold of a deserializer for a value of given type; or if no such deserializer can be found, a default handler (which may do a best-effort generic serialization or just simply throw an exception when invoked).
 JsonDeserializer<Object> findValueDeserializer(DeserializationConfig config, JavaType type, JavaType referrer, String refPropName)
          Deprecated. As of version 1.7, use version that exposes property object instead of just its type (needed for contextual deserializers)
abstract  void flushCachedDeserializers()
          Method that will drop all dynamically constructed deserializers (ones that are counted as result value for cachedDeserializersCount()).
abstract  boolean hasValueDeserializerFor(DeserializationConfig config, JavaType type)
          Method called to find out whether provider would be able to find a deserializer for given type, using a root reference (i.e.
abstract  DeserializerProvider withAbstractTypeResolver(AbstractTypeResolver resolver)
           
abstract  DeserializerProvider withAdditionalDeserializers(Deserializers d)
          Method that is to configure DeserializerFactory that provider has to use specified deserializer provider, with highest precedence (that is, additional providers have higher precedence than default one or previously added ones)
abstract  DeserializerProvider withAdditionalKeyDeserializers(KeyDeserializers d)
           
abstract  DeserializerProvider withDeserializerModifier(BeanDeserializerModifier modifier)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DeserializerProvider

protected DeserializerProvider()
Method Detail

withAdditionalDeserializers

public abstract DeserializerProvider withAdditionalDeserializers(Deserializers d)
Method that is to configure DeserializerFactory that provider has to use specified deserializer provider, with highest precedence (that is, additional providers have higher precedence than default one or previously added ones)

Since:
1.7

withAdditionalKeyDeserializers

public abstract DeserializerProvider withAdditionalKeyDeserializers(KeyDeserializers d)
Since:
1.8

withDeserializerModifier

public abstract DeserializerProvider withDeserializerModifier(BeanDeserializerModifier modifier)
Since:
1.7

withAbstractTypeResolver

public abstract DeserializerProvider withAbstractTypeResolver(AbstractTypeResolver resolver)
Since:
1.8

findValueDeserializer

public abstract JsonDeserializer<Object> findValueDeserializer(DeserializationConfig config,
                                                               JavaType propertyType,
                                                               BeanProperty property)
                                                        throws JsonMappingException
Method called to get hold of a deserializer for a value of given type; or if no such deserializer can be found, a default handler (which may do a best-effort generic serialization or just simply throw an exception when invoked).

Note: this method is only called for value types; not for keys. Key deserializers can be accessed using findKeyDeserializer(org.codehaus.jackson.map.DeserializationConfig, org.codehaus.jackson.type.JavaType, org.codehaus.jackson.map.BeanProperty).

Parameters:
config - Deserialization configuration
propertyType - Declared type of the value to deserializer (obtained using 'setter' method signature and/or type annotations
property - Object that represents accessor for property value; field, setter method or constructor parameter.
Throws:
JsonMappingException - if there are fatal problems with accessing suitable deserializer; including that of not finding any serializer

findTypedValueDeserializer

public abstract JsonDeserializer<Object> findTypedValueDeserializer(DeserializationConfig config,
                                                                    JavaType type,
                                                                    BeanProperty property)
                                                             throws JsonMappingException
Method called to locate deserializer for given type, as well as matching type deserializer (if one is needed); and if type deserializer is needed, construct a "wrapped" deserializer that can extract and use type information for calling actual deserializer.

Since this method is only called for root elements, no referral information is taken.

Throws:
JsonMappingException
Since:
1.5

findKeyDeserializer

public abstract KeyDeserializer findKeyDeserializer(DeserializationConfig config,
                                                    JavaType keyType,
                                                    BeanProperty property)
                                             throws JsonMappingException
Method called to get hold of a deserializer to use for deserializing keys for Map.

Throws:
JsonMappingException - if there are fatal problems with accessing suitable key deserializer; including that of not finding any serializer

hasValueDeserializerFor

public abstract boolean hasValueDeserializerFor(DeserializationConfig config,
                                                JavaType type)
Method called to find out whether provider would be able to find a deserializer for given type, using a root reference (i.e. not through fields or membership in an array or collection)


findValueDeserializer

@Deprecated
public final JsonDeserializer<Object> findValueDeserializer(DeserializationConfig config,
                                                                       JavaType type,
                                                                       JavaType referrer,
                                                                       String refPropName)
                                                     throws JsonMappingException
Deprecated. As of version 1.7, use version that exposes property object instead of just its type (needed for contextual deserializers)

Deprecated version of accessor method that was used before version 1.7. Implemented as final to ensure that existing code does not accidentally try to redefine it (given that it is not called by core mapper code)

Throws:
JsonMappingException

findTypedValueDeserializer

@Deprecated
public final JsonDeserializer<Object> findTypedValueDeserializer(DeserializationConfig config,
                                                                            JavaType type)
                                                          throws JsonMappingException
Deprecated. As of version 1.7, use version that exposes context class and property, instead of just types

Deprecated version of accessor method that was used before version 1.7. Implemented as final to ensure that existing code does not accidentally try to redefine it (given that it is not called by core mapper code)

Throws:
JsonMappingException

findKeyDeserializer

@Deprecated
public final KeyDeserializer findKeyDeserializer(DeserializationConfig config,
                                                            JavaType keyType)
                                          throws JsonMappingException
Deprecated. As of version 1.7, use version that exposes context class and property, instead of just types

Deprecated version of accessor method that was used before version 1.7. Implemented as final to ensure that existing code does not accidentally try to redefine it (given that it is not called by core mapper code)

Throws:
JsonMappingException

cachedDeserializersCount

public abstract int cachedDeserializersCount()
Method that can be used to determine how many deserializers this provider is caching currently (if it does caching: default implementation does) Exact count depends on what kind of deserializers get cached; default implementation caches only dynamically constructed deserializers, but not eagerly constructed standard deserializers (which is different from how serializer provider works).

The main use case for this method is to allow conditional flushing of deserializer cache, if certain number of entries is reached.

Since:
1.4

flushCachedDeserializers

public abstract void flushCachedDeserializers()
Method that will drop all dynamically constructed deserializers (ones that are counted as result value for cachedDeserializersCount()). This can be used to remove memory usage (in case some deserializers are only used once or so), or to force re-construction of deserializers after configuration changes for mapper than owns the provider.

Since:
1.4