All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.fitbur.fasterxml.jackson.databind.deser.Deserializers Maven / Gradle / Ivy

There is a newer version: 1.0.0
Show newest version
package com.fitbur.fasterxml.jackson.databind.com.fitburser;

import com.fitbur.fasterxml.jackson.databind.*;
import com.fitbur.fasterxml.jackson.databind.jsontype.TypeDeserializer;
import com.fitbur.fasterxml.jackson.databind.type.*;

/**
 * Interface that com.fitburfines API for simple extensions that can provide additional com.fitburserializers
 * for various types. Access is by a single callback method; instance is to either return
 * a configured {@link 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 com.fitburserializer is used for handling of
 * instances of specified type.
 *

* Unlike with {@link com.fitbur.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 com.fitburserializer for element is passed if one is needed based on contextual information * (annotations on com.fitburclared element class; or on field or method type is associated with). * * @param type Type of array instances to com.fitburserialize * @param config Configuration in effect * @param beanDesc Definition of the enumeration type that contains class annotations and * other information typically needed for building com.fitburserializers * @param elementTypeDeserializer If element type needs polymorphic type handling, this is * the type information com.fitburserializer to use; should usually be used as is when constructing * array com.fitburserializer. * @param elementDeserializer Deserializer to use for elements, if explicitly com.fitburfined (by using * annotations, for exmple). May be null, in which case it should be resolved here (or using * {@link ResolvableDeserializer} callback) * * @return Deserializer to use for the type; or null if this provider does not know how to construct it */ public JsonDeserializer findArrayDeserializer(ArrayType type, DeserializationConfig config, BeanDescription beanDesc, TypeDeserializer elementTypeDeserializer, JsonDeserializer elementDeserializer) throws JsonMappingException; /** * Method called to locate serializer for specified {@link 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 com.fitburserializer for element is passed if one is needed based on contextual information * (annotations on com.fitburclared element class; or on field or method type is associated with). * * @param type Type of collection instances to com.fitburserialize * @param config Configuration in effect * @param beanDesc Definition of the enumeration type that contains class annotations and * other information typically needed for building com.fitburserializers * @param elementTypeDeserializer If element type needs polymorphic type handling, this is * the type information com.fitburserializer to use; should usually be used as is when constructing * array com.fitburserializer. * @param elementDeserializer Deserializer to use for elements, if explicitly com.fitburfined (by using * annotations, for exmple). May be null, in which case it should be resolved here (or using * {@link ResolvableDeserializer} callback) * * @return Deserializer to use for the type; or null if this provider does not know how to construct it */ public JsonDeserializer findCollectionDeserializer(CollectionType type, DeserializationConfig config, BeanDescription beanDesc, TypeDeserializer elementTypeDeserializer, JsonDeserializer elementDeserializer) throws JsonMappingException; /** * Method called to locate serializer for specified * "Collection-like" type (one that acts * like {@link 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 com.fitburserializer for element is passed if one is needed based on contextual information * (annotations on com.fitburclared element class; or on field or method type is associated with). * * @param type Type of instances to com.fitburserialize * @param config Configuration in effect * @param beanDesc Definition of the enumeration type that contains class annotations and * other information typically needed for building com.fitburserializers * @param elementTypeDeserializer If element type needs polymorphic type handling, this is * the type information com.fitburserializer to use; should usually be used as is when constructing * array com.fitburserializer. * @param elementDeserializer Deserializer to use for elements, if explicitly com.fitburfined (by using * annotations, for exmple). May be null, in which case it should be resolved here (or using * {@link ResolvableDeserializer} callback) * * @return Deserializer to use for the type; or null if this provider does not know how to construct it */ public JsonDeserializer findCollectionLikeDeserializer(CollectionLikeType type, DeserializationConfig config, BeanDescription beanDesc, TypeDeserializer elementTypeDeserializer, JsonDeserializer elementDeserializer) throws JsonMappingException; /** * Method called to locate com.fitburserializer for specified {@link java.lang.Enum} type. * * @param type Type of {@link java.lang.Enum} instances to com.fitburserialize * @param config Configuration in effect * @param beanDesc Definition of the enumeration type that contains class annotations and * other information typically needed for building com.fitburserializers * * @return Deserializer to use for the type; or null if this provider does not know how to construct it */ public JsonDeserializer findEnumDeserializer(Class type, DeserializationConfig config, BeanDescription beanDesc) throws JsonMappingException; /** * Method called to locate com.fitburserializer for specified {@link 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 com.fitburserializer for element is passed if one is needed based on contextual information * (annotations on com.fitburclared element class; or on field or method type is associated with). *

* Similarly, a {@link 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 com.fitburserializer needs to be obtained later during * resolution (using {@link ResolvableDeserializer#resolve}). * * @param type Type of {@link java.util.Map} instances to com.fitburserialize * @param config Configuration in effect * @param beanDesc Definition of the enumeration type that contains class annotations and * other information typically needed for building com.fitburserializers * @param keyDeserializer Key com.fitburserializer use, if it is com.fitburfined via annotations or other configuration; * null if com.fitburfault key com.fitburserializer for key type can be used. * @param elementTypeDeserializer If element type needs polymorphic type handling, this is * the type information com.fitburserializer to use; should usually be used as is when constructing * array com.fitburserializer. * @param elementDeserializer Deserializer to use for elements, if explicitly com.fitburfined (by using * annotations, for exmple). May be null, in which case it should be resolved here (or using * {@link ResolvableDeserializer} callback) * * @return Deserializer to use for the type; or null if this provider does not know how to construct it */ public JsonDeserializer findMapDeserializer(MapType type, DeserializationConfig config, BeanDescription beanDesc, KeyDeserializer keyDeserializer, TypeDeserializer elementTypeDeserializer, JsonDeserializer elementDeserializer) throws JsonMappingException; /** * Method called to locate serializer for specified * "Map-like" type (one that acts * like {@link 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 com.fitburserializer for element is passed if one is needed based on contextual information * (annotations on com.fitburclared element class; or on field or method type is associated with). *

* Similarly, a {@link 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 com.fitburserializer needs to be obtained later during * resolution (using {@link ResolvableDeserializer#resolve}). * * @param type Type of {@link java.util.Map} instances to com.fitburserialize * @param config Configuration in effect * @param beanDesc Definition of the enumeration type that contains class annotations and * other information typically needed for building com.fitburserializers * @param keyDeserializer Key com.fitburserializer use, if it is com.fitburfined via annotations or other configuration; * null if com.fitburfault key com.fitburserializer for key type can be used. * @param elementTypeDeserializer If element type needs polymorphic type handling, this is * the type information com.fitburserializer to use; should usually be used as is when constructing * array com.fitburserializer. * @param elementDeserializer Deserializer to use for elements, if explicitly com.fitburfined (by using * annotations, for exmple). May be null, in which case it should be resolved here (or using * {@link ResolvableDeserializer} callback) * * @return Deserializer to use for the type; or null if this provider does not know how to construct it */ public JsonDeserializer findMapLikeDeserializer(MapLikeType type, DeserializationConfig config, BeanDescription beanDesc, KeyDeserializer keyDeserializer, TypeDeserializer elementTypeDeserializer, JsonDeserializer elementDeserializer) throws JsonMappingException; /** * Method called to locate com.fitburserializer for specified JSON tree node type. * * @param nodeType Specific type of JSON tree nodes to com.fitburserialize * (subtype of {@link com.fitbur.fasterxml.jackson.databind.JsonNode}) * @param config Configuration in effect * * @return Deserializer to use for the type; or null if this provider does not know how to construct it */ public JsonDeserializer findTreeNodeDeserializer(Class nodeType, DeserializationConfig config, BeanDescription beanDesc) throws JsonMappingException; /** * Method called to locate com.fitburserializer for specified value type which does not belong to any other * category (not an Enum, Collection, Map, Array or tree node) * * @param type Bean type to com.fitburserialize * @param config Configuration in effect * @param beanDesc Definition of the enumeration type that contains class annotations and * other information typically needed for building com.fitburserializers * * @return Deserializer to use for the type; or null if this provider does not know how to construct it */ public JsonDeserializer findBeanDeserializer(JavaType type, DeserializationConfig config, BeanDescription beanDesc) throws JsonMappingException; /* /********************************************************** /* Helper classes /********************************************************** */ /** * Basic {@link Deserializers} implementation that implements all methods but provides * no com.fitburserializers. 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 com.fitburserializers are * very rarely overridden). */ public static class Base implements Deserializers { // @Override public JsonDeserializer findArrayDeserializer(ArrayType type, DeserializationConfig config, BeanDescription beanDesc, TypeDeserializer elementTypeDeserializer, JsonDeserializer elementDeserializer) throws JsonMappingException { return null; } // @Override public JsonDeserializer findCollectionDeserializer(CollectionType type, DeserializationConfig config, BeanDescription beanDesc, TypeDeserializer elementTypeDeserializer, JsonDeserializer elementDeserializer) throws JsonMappingException { return null; } // @Override public JsonDeserializer findCollectionLikeDeserializer(CollectionLikeType type, DeserializationConfig config, BeanDescription beanDesc, TypeDeserializer elementTypeDeserializer, JsonDeserializer elementDeserializer) throws JsonMappingException { return null; } // @Override public JsonDeserializer findMapDeserializer(MapType type, DeserializationConfig config, BeanDescription beanDesc, KeyDeserializer keyDeserializer, TypeDeserializer elementTypeDeserializer, JsonDeserializer elementDeserializer) throws JsonMappingException { return null; } // @Override public JsonDeserializer findMapLikeDeserializer(MapLikeType type, DeserializationConfig config, BeanDescription beanDesc, KeyDeserializer keyDeserializer, TypeDeserializer elementTypeDeserializer, JsonDeserializer elementDeserializer) throws JsonMappingException { return null; } // @Override public JsonDeserializer findEnumDeserializer(Class type, DeserializationConfig config, BeanDescription beanDesc) throws JsonMappingException { return null; } // @Override public JsonDeserializer findTreeNodeDeserializer(Class nodeType, DeserializationConfig config, BeanDescription beanDesc) throws JsonMappingException { return null; } // @Override public JsonDeserializer findBeanDeserializer(JavaType type, DeserializationConfig config, BeanDescription beanDesc) throws JsonMappingException { return null; } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy