public abstract class DeserializerProvider extends Object
ObjectMapper
and
JsonDeserializer
s to obtain deserializers capable of
re-constructing instances of handled type from JSON content.Modifier | Constructor and Description |
---|---|
protected |
DeserializerProvider() |
Modifier and Type | Method and Description |
---|---|
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).
|
abstract SerializedString |
findExpectedRootName(DeserializationConfig config,
JavaType type)
Method that can be used to try find expected root name for given type
|
abstract KeyDeserializer |
findKeyDeserializer(DeserializationConfig config,
JavaType keyType,
BeanProperty property)
Method called to get hold of a deserializer to use for deserializing
keys for
Map . |
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).
|
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 JavaType |
mapAbstractType(DeserializationConfig config,
JavaType type)
Method that can be called to try to resolve an abstract type
(interface, abstract class) into a concrete type, or at least
something "more concrete" (abstract class instead of interface).
|
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) |
abstract DeserializerProvider |
withFactory(DeserializerFactory factory)
Method that sub-classes need to override, to ensure that fluent-factory
methods will produce proper sub-type.
|
abstract DeserializerProvider |
withValueInstantiators(ValueInstantiators instantiators)
Method that will construct a new instance with specified additional value instantiators
(i.e.
|
public abstract DeserializerProvider withFactory(DeserializerFactory factory)
public abstract DeserializerProvider withAdditionalDeserializers(Deserializers d)
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)public abstract DeserializerProvider withAdditionalKeyDeserializers(KeyDeserializers d)
public abstract DeserializerProvider withDeserializerModifier(BeanDeserializerModifier modifier)
public abstract DeserializerProvider withAbstractTypeResolver(AbstractTypeResolver resolver)
public abstract DeserializerProvider withValueInstantiators(ValueInstantiators instantiators)
public abstract JsonDeserializer<Object> findValueDeserializer(DeserializationConfig config, JavaType propertyType, BeanProperty property) throws JsonMappingException
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)
.
config
- Deserialization configurationpropertyType
- Declared type of the value to deserializer (obtained using
'setter' method signature and/or type annotationsproperty
- Object that represents accessor for property value; field,
setter method or constructor parameter.JsonMappingException
- if there are fatal problems with
accessing suitable deserializer; including that of not
finding any serializerpublic abstract JsonDeserializer<Object> findTypedValueDeserializer(DeserializationConfig config, JavaType type, BeanProperty property) throws JsonMappingException
Since this method is only called for root elements, no referral information is taken.
JsonMappingException
public abstract KeyDeserializer findKeyDeserializer(DeserializationConfig config, JavaType keyType, BeanProperty property) throws JsonMappingException
Map
.JsonMappingException
- if there are fatal problems with
accessing suitable key deserializer; including that of not
finding any serializerpublic abstract boolean hasValueDeserializerFor(DeserializationConfig config, JavaType type)
public abstract JavaType mapAbstractType(DeserializationConfig config, JavaType type) throws JsonMappingException
JsonMappingException
public abstract SerializedString findExpectedRootName(DeserializationConfig config, JavaType type) throws JsonMappingException
JsonMappingException
public abstract int cachedDeserializersCount()
The main use case for this method is to allow conditional flushing of deserializer cache, if certain number of entries is reached.
public abstract void flushCachedDeserializers()
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.