Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package com.fasterxml.jackson.databind.deser;
  
Interface that defines API for simple extensions that can provide additional deserializers for various types. Access is by a single callback method; instance is to either return a configured com.fasterxml.jackson.databind.JsonDeserializer for specified type, or null to indicate that it does not support handling of the type. In latter case, further calls can be made for other providers; in former case returned deserializer is used for handling of instances of specified type.

Unlike with com.fasterxml.jackson.databind.ser.Serializers, multiple different methods are used since different kinds of types typically require different kinds of inputs.

 
 public interface Deserializers
 {
    
Method called to locate serializer for specified array type.

Deserializer for element type may be passed, if configured explicitly at higher level (by annotations, typically), but usually are not. Type deserializer for element is passed if one is needed based on contextual information (annotations on declared element class; or on field or method type is associated with).

Parameters:
type Type of array instances to deserialize
config Configuration in effect
beanDesc Definition of the enumeration type that contains class annotations and other information typically needed for building deserializers
elementTypeDeserializer If element type needs polymorphic type handling, this is the type information deserializer to use; should usually be used as is when constructing array deserializer.
elementDeserializer Deserializer to use for elements, if explicitly defined (by using annotations, for exmple). May be null, in which case it should be resolved here (or using ResolvableDeserializer callback)
Returns:
Deserializer to use for the type; or null if this provider does not know how to construct it
 
             DeserializationConfig configBeanDescription beanDesc,
             TypeDeserializer elementTypeDeserializerJsonDeserializer<?> elementDeserializer)
         throws JsonMappingException;

    
Method called to locate serializer for specified java.util.Collection (List, Set etc) type.

Deserializer for element type may be passed, if configured explicitly at higher level (by annotations, typically), but usually are not. Type deserializer for element is passed if one is needed based on contextual information (annotations on declared element class; or on field or method type is associated with).

Parameters:
type Type of collection instances to deserialize
config Configuration in effect
beanDesc Definition of the enumeration type that contains class annotations and other information typically needed for building deserializers
elementTypeDeserializer If element type needs polymorphic type handling, this is the type information deserializer to use; should usually be used as is when constructing array deserializer.
elementDeserializer Deserializer to use for elements, if explicitly defined (by using annotations, for exmple). May be null, in which case it should be resolved here (or using ResolvableDeserializer callback)
Returns:
Deserializer to use for the type; or null if this provider does not know how to construct it
 
             DeserializationConfig configBeanDescription beanDesc,
             TypeDeserializer elementTypeDeserializerJsonDeserializer<?> elementDeserializer)
         throws JsonMappingException;

    
Method called to locate serializer for specified "Collection-like" type (one that acts like java.util.Collection but does not implement it).

Deserializer for element type may be passed, if configured explicitly at higher level (by annotations, typically), but usually are not. Type deserializer for element is passed if one is needed based on contextual information (annotations on declared element class; or on field or method type is associated with).

Parameters:
type Type of instances to deserialize
config Configuration in effect
beanDesc Definition of the enumeration type that contains class annotations and other information typically needed for building deserializers
elementTypeDeserializer If element type needs polymorphic type handling, this is the type information deserializer to use; should usually be used as is when constructing array deserializer.
elementDeserializer Deserializer to use for elements, if explicitly defined (by using annotations, for exmple). May be null, in which case it should be resolved here (or using ResolvableDeserializer callback)
Returns:
Deserializer to use for the type; or null if this provider does not know how to construct it
 
             DeserializationConfig configBeanDescription beanDesc,
             TypeDeserializer elementTypeDeserializerJsonDeserializer<?> elementDeserializer)
         throws JsonMappingException;
    
    
Method called to locate deserializer for specified java.lang.Enum type.

Parameters:
type Type of java.lang.Enum instances to deserialize
config Configuration in effect
beanDesc Definition of the enumeration type that contains class annotations and other information typically needed for building deserializers
Returns:
Deserializer to use for the type; or null if this provider does not know how to construct it
    public JsonDeserializer<?> findEnumDeserializer(Class<?> type,
            DeserializationConfig configBeanDescription beanDesc)
        throws JsonMappingException;

    
Method called to locate deserializer for specified java.util.Map type.

Deserializer for element type may be passed, if configured explicitly at higher level (by annotations, typically), but usually are not. Type deserializer for element is passed if one is needed based on contextual information (annotations on declared element class; or on field or method type is associated with).

Similarly, a com.fasterxml.jackson.databind.KeyDeserializer may be passed, but this is only done if there is a specific configuration override (annotations) to indicate instance to use. Otherwise null is passed, and key deserializer needs to be obtained later during resolution (using ResolvableDeserializer.resolve(com.fasterxml.jackson.databind.DeserializationContext)).

Parameters:
type Type of java.util.Map instances to deserialize
config Configuration in effect
beanDesc Definition of the enumeration type that contains class annotations and other information typically needed for building deserializers
keyDeserializer Key deserializer use, if it is defined via annotations or other configuration; null if default key deserializer for key type can be used.
elementTypeDeserializer If element type needs polymorphic type handling, this is the type information deserializer to use; should usually be used as is when constructing array deserializer.
elementDeserializer Deserializer to use for elements, if explicitly defined (by using annotations, for exmple). May be null, in which case it should be resolved here (or using ResolvableDeserializer callback)
Returns:
Deserializer to use for the type; or null if this provider does not know how to construct it
            DeserializationConfig configBeanDescription beanDesc,
            KeyDeserializer keyDeserializer,
            TypeDeserializer elementTypeDeserializerJsonDeserializer<?> elementDeserializer)
        throws JsonMappingException;

    
Method called to locate serializer for specified "Map-like" type (one that acts like java.util.Map but does not implement it).

Deserializer for element type may be passed, if configured explicitly at higher level (by annotations, typically), but usually are not. Type deserializer for element is passed if one is needed based on contextual information (annotations on declared element class; or on field or method type is associated with).

Similarly, a com.fasterxml.jackson.databind.KeyDeserializer may be passed, but this is only done if there is a specific configuration override (annotations) to indicate instance to use. Otherwise null is passed, and key deserializer needs to be obtained later during resolution (using ResolvableDeserializer.resolve(com.fasterxml.jackson.databind.DeserializationContext)).

Parameters:
type Type of java.util.Map instances to deserialize
config Configuration in effect
beanDesc Definition of the enumeration type that contains class annotations and other information typically needed for building deserializers
keyDeserializer Key deserializer use, if it is defined via annotations or other configuration; null if default key deserializer for key type can be used.
elementTypeDeserializer If element type needs polymorphic type handling, this is the type information deserializer to use; should usually be used as is when constructing array deserializer.
elementDeserializer Deserializer to use for elements, if explicitly defined (by using annotations, for exmple). May be null, in which case it should be resolved here (or using ResolvableDeserializer callback)
Returns:
Deserializer to use for the type; or null if this provider does not know how to construct it
            DeserializationConfig configBeanDescription beanDesc,
            KeyDeserializer keyDeserializer,
            TypeDeserializer elementTypeDeserializerJsonDeserializer<?> elementDeserializer)
        throws JsonMappingException;
    
    
Method called to locate deserializer for specified JSON tree node type.

Parameters:
nodeType Specific type of JSON tree nodes to deserialize (subtype of com.fasterxml.jackson.databind.JsonNode)
config Configuration in effect
Returns:
Deserializer to use for the type; or null if this provider does not know how to construct it
    public JsonDeserializer<?> findTreeNodeDeserializer(Class<? extends JsonNodenodeType,
            DeserializationConfig configBeanDescription beanDesc)
        throws JsonMappingException;
    
    
Method called to locate deserializer for specified value type which does not belong to any other category (not an Enum, Collection, Map, Array or tree node)

Parameters:
type Bean type to deserialize
config Configuration in effect
beanDesc Definition of the enumeration type that contains class annotations and other information typically needed for building deserializers
Returns:
Deserializer to use for the type; or null if this provider does not know how to construct it
            DeserializationConfig configBeanDescription beanDesc)
        throws JsonMappingException;
    /*
    /**********************************************************
    /* Helper classes
    /**********************************************************
     */

    
Basic Deserializers implementation that implements all methods but provides no deserializers. Its main purpose is to serve as a base class so that sub-classes only need to override methods they need, as most of the time some of methods are not needed (especially enumeration and array deserializers are very rarely overridden).
    public static class Base implements Deserializers
    {
//      @Override
        public JsonDeserializer<?> findArrayDeserializer(ArrayType type,
                DeserializationConfig configBeanDescription beanDesc,
                TypeDeserializer elementTypeDeserializerJsonDeserializer<?> elementDeserializer)
            throws JsonMappingException
        {
            return null;
        }
//      @Override
                DeserializationConfig configBeanDescription beanDesc,
                TypeDeserializer elementTypeDeserializerJsonDeserializer<?> elementDeserializer)
            throws JsonMappingException
        {
            return null;
        }
//      @Override
                DeserializationConfig configBeanDescription beanDesc,
                TypeDeserializer elementTypeDeserializerJsonDeserializer<?> elementDeserializer)
            throws JsonMappingException
        {
            return null;
        }
//      @Override
        public JsonDeserializer<?> findMapDeserializer(MapType type,
                DeserializationConfig configBeanDescription beanDesc,
                KeyDeserializer keyDeserializer,
                TypeDeserializer elementTypeDeserializerJsonDeserializer<?> elementDeserializer)
            throws JsonMappingException
        {
            return null;
        }
//      @Override
        public JsonDeserializer<?> findMapLikeDeserializer(MapLikeType type,
                DeserializationConfig configBeanDescription beanDesc,
                KeyDeserializer keyDeserializer,
                TypeDeserializer elementTypeDeserializerJsonDeserializer<?> elementDeserializer)
            throws JsonMappingException
        {
            return null;
        }
//      @Override
        public JsonDeserializer<?> findEnumDeserializer(Class<?> type,
                DeserializationConfig configBeanDescription beanDesc)
            throws JsonMappingException
        {
            return null;
        }
        
//      @Override
        public JsonDeserializer<?> findTreeNodeDeserializer(Class<? extends JsonNodenodeType,
                DeserializationConfig configBeanDescription beanDesc)
            throws JsonMappingException
        {
            return null;
        }
//      @Override
        public JsonDeserializer<?> findBeanDeserializer(JavaType type,
                DeserializationConfig configBeanDescription beanDesc)
            throws JsonMappingException
        {
            return null;
        }
    }
New to GrepCode? Check out our FAQ X