java.lang.Object
tools.jackson.databind.ser.Serializers.Base
- All Implemented Interfaces:
Serializers
- Direct Known Subclasses:
SimpleSerializers
- Enclosing interface:
- Serializers
Basic
Serializers implementation that implements all methods but provides
no serializers. Its main purpose is to serve as a base class so that
sub-classes only need to override methods they need.-
Nested Class Summary
Nested classes/interfaces inherited from interface tools.jackson.databind.ser.Serializers
Serializers.Base -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected JsonFormat.ValuecalculateEffectiveFormat(BeanDescription beanDesc, Class<?> baseType, JsonFormat.Value formatOverrides) Helper method for determining effective combination of formatting settings from combination of Class annotations and config overrides for type and possible per-property overrides (in this order of precedence from lowest to highest).findArraySerializer(SerializationConfig config, ArrayType type, BeanDescription beanDesc, JsonFormat.Value formatOverrides, TypeSerializer elementTypeSerializer, ValueSerializer<Object> elementValueSerializer) Method called by serialization framework first time a serializer is needed for specified array type.findCollectionLikeSerializer(SerializationConfig config, CollectionLikeType type, BeanDescription beanDesc, JsonFormat.Value formatOverrides, TypeSerializer elementTypeSerializer, ValueSerializer<Object> elementValueSerializer) Method called by serialization framework first time a serializer is needed for specified "Collection-like" type (type that acts likeCollection, but does not implement it).findCollectionSerializer(SerializationConfig config, CollectionType type, BeanDescription beanDesc, JsonFormat.Value formatOverrides, TypeSerializer elementTypeSerializer, ValueSerializer<Object> elementValueSerializer) Method called by serialization framework first time a serializer is needed for specifiedCollectiontype.findExplicitPOJOSerializer(SerializationConfig config, JavaType type, BeanDescription beanDesc, JsonFormat.Value formatOverrides) Method called in case that a given type or property is declared to use shapeJsonFormat.Shape.POJOand is expected to be serialized "as POJO", that is, as an (JSON) Object.findMapLikeSerializer(SerializationConfig config, MapLikeType type, BeanDescription beanDesc, JsonFormat.Value formatOverrides, ValueSerializer<Object> keySerializer, TypeSerializer elementTypeSerializer, ValueSerializer<Object> elementValueSerializer) Method called by serialization framework first time a serializer is needed for specified "Map-like" type (type that acts likeMap, but does not implement it).findMapSerializer(SerializationConfig config, MapType type, BeanDescription beanDesc, JsonFormat.Value formatOverrides, ValueSerializer<Object> keySerializer, TypeSerializer elementTypeSerializer, ValueSerializer<Object> elementValueSerializer) Method called by serialization framework first time a serializer is needed for specifiedMaptype.findReferenceSerializer(SerializationConfig config, ReferenceType type, BeanDescription beanDesc, JsonFormat.Value formatOverrides, TypeSerializer contentTypeSerializer, ValueSerializer<Object> contentValueSerializer) Method called by serialization framework first time a serializer is needed for givenReferenceTypefindSerializer(SerializationConfig config, JavaType type, BeanDescription beanDesc, JsonFormat.Value formatOverrides) Method called by serialization framework first time a serializer is needed for specified type, which is not of a container or reference type (for which other methods are called).
-
Constructor Details
-
Base
public Base()
-
-
Method Details
-
findSerializer
public ValueSerializer<?> findSerializer(SerializationConfig config, JavaType type, BeanDescription beanDesc, JsonFormat.Value formatOverrides) Description copied from interface:SerializersMethod called by serialization framework first time a serializer is needed for specified type, which is not of a container or reference type (for which other methods are called).- Specified by:
findSerializerin interfaceSerializers- Parameters:
config- Serialization configuration in usetype- Fully resolved type of instances to serializebeanDesc- Additional information about typeformatOverrides- (nullable) Optional format overrides (usually from property definition), to change definitions thatbeanDescmay have (and which are NOT included). Usually combined callingSerializers.Base#calculateEffectiveFormat.- Returns:
- Configured serializer to use for the type; or null if implementation does not recognize or support type
-
findReferenceSerializer
public ValueSerializer<?> findReferenceSerializer(SerializationConfig config, ReferenceType type, BeanDescription beanDesc, JsonFormat.Value formatOverrides, TypeSerializer contentTypeSerializer, ValueSerializer<Object> contentValueSerializer) Description copied from interface:SerializersMethod called by serialization framework first time a serializer is needed for givenReferenceType- Specified by:
findReferenceSerializerin interfaceSerializersformatOverrides- (nullable) Optional format overrides (usually from property definition), to change definitions thatbeanDescmay have (and which are NOT included). Usually combined callingSerializers.Base#calculateEffectiveFormat.
-
findArraySerializer
public ValueSerializer<?> findArraySerializer(SerializationConfig config, ArrayType type, BeanDescription beanDesc, JsonFormat.Value formatOverrides, TypeSerializer elementTypeSerializer, ValueSerializer<Object> elementValueSerializer) Description copied from interface:SerializersMethod called by serialization framework first time a serializer is needed for specified array type. Implementation should return a serializer instance if it supports specified type; or null if it does not.- Specified by:
findArraySerializerin interfaceSerializersformatOverrides- (nullable) Optional format overrides (usually from property definition), to change definitions thatbeanDescmay have (and which are NOT included). Usually combined callingSerializers.Base#calculateEffectiveFormat.
-
findCollectionSerializer
public ValueSerializer<?> findCollectionSerializer(SerializationConfig config, CollectionType type, BeanDescription beanDesc, JsonFormat.Value formatOverrides, TypeSerializer elementTypeSerializer, ValueSerializer<Object> elementValueSerializer) Description copied from interface:SerializersMethod called by serialization framework first time a serializer is needed for specifiedCollectiontype. Implementation should return a serializer instance if it supports specified type; or null if it does not.- Specified by:
findCollectionSerializerin interfaceSerializersformatOverrides- (nullable) Optional format overrides (usually from property definition), to change definitions thatbeanDescmay have (and which are NOT included). Usually combined callingSerializers.Base#calculateEffectiveFormat.
-
findCollectionLikeSerializer
public ValueSerializer<?> findCollectionLikeSerializer(SerializationConfig config, CollectionLikeType type, BeanDescription beanDesc, JsonFormat.Value formatOverrides, TypeSerializer elementTypeSerializer, ValueSerializer<Object> elementValueSerializer) Description copied from interface:SerializersMethod called by serialization framework first time a serializer is needed for specified "Collection-like" type (type that acts likeCollection, but does not implement it). Implementation should return a serializer instance if it supports specified type; or null if it does not.- Specified by:
findCollectionLikeSerializerin interfaceSerializersformatOverrides- (nullable) Optional format overrides (usually from property definition), to change definitions thatbeanDescmay have (and which are NOT included). Usually combined callingSerializers.Base#calculateEffectiveFormat.
-
findMapSerializer
public ValueSerializer<?> findMapSerializer(SerializationConfig config, MapType type, BeanDescription beanDesc, JsonFormat.Value formatOverrides, ValueSerializer<Object> keySerializer, TypeSerializer elementTypeSerializer, ValueSerializer<Object> elementValueSerializer) Description copied from interface:SerializersMethod called by serialization framework first time a serializer is needed for specifiedMaptype. Implementation should return a serializer instance if it supports specified type; or null if it does not.- Specified by:
findMapSerializerin interfaceSerializersformatOverrides- (nullable) Optional format overrides (usually from property definition), to change definitions thatbeanDescmay have (and which are NOT included). Usually combined callingSerializers.Base#calculateEffectiveFormat.
-
findMapLikeSerializer
public ValueSerializer<?> findMapLikeSerializer(SerializationConfig config, MapLikeType type, BeanDescription beanDesc, JsonFormat.Value formatOverrides, ValueSerializer<Object> keySerializer, TypeSerializer elementTypeSerializer, ValueSerializer<Object> elementValueSerializer) Description copied from interface:SerializersMethod called by serialization framework first time a serializer is needed for specified "Map-like" type (type that acts likeMap, but does not implement it). Implementation should return a serializer instance if it supports specified type; or null if it does not.- Specified by:
findMapLikeSerializerin interfaceSerializersformatOverrides- (nullable) Optional format overrides (usually from property definition), to change definitions thatbeanDescmay have (and which are NOT included). Usually combined callingSerializers.Base#calculateEffectiveFormat.
-
findExplicitPOJOSerializer
public ValueSerializer<?> findExplicitPOJOSerializer(SerializationConfig config, JavaType type, BeanDescription beanDesc, JsonFormat.Value formatOverrides) Description copied from interface:SerializersMethod called in case that a given type or property is declared to use shapeJsonFormat.Shape.POJOand is expected to be serialized "as POJO", that is, as an (JSON) Object. This is usually NOT handled by extension modules as core databind knows how to do this, but sometimes it may be necessary to override this behavior.- Specified by:
findExplicitPOJOSerializerin interfaceSerializers
-
calculateEffectiveFormat
protected JsonFormat.Value calculateEffectiveFormat(BeanDescription beanDesc, Class<?> baseType, JsonFormat.Value formatOverrides) Helper method for determining effective combination of formatting settings from combination of Class annotations and config overrides for type and possible per-property overrides (in this order of precedence from lowest to highest).
-