Interface Serializers
-
- All Known Implementing Classes:
CoreXMLSerializers
,Serializers.Base
,SimpleSerializers
public interface Serializers
Interface that defines API for simple extensions that can provide additional serializers for various types. Access is by a single callback method; instance is to either return a configuredJsonSerializer
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 serializer is used for handling of instances of specified type.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
Serializers.Base
BasicSerializers
implementation that implements all methods but provides no serializers.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description JsonSerializer<?>
findArraySerializer(SerializationConfig config, ArrayType type, BeanDescription beanDesc, TypeSerializer elementTypeSerializer, JsonSerializer<java.lang.Object> elementValueSerializer)
Method called by serialization framework first time a serializer is needed for specified array type.JsonSerializer<?>
findCollectionLikeSerializer(SerializationConfig config, CollectionLikeType type, BeanDescription beanDesc, TypeSerializer elementTypeSerializer, JsonSerializer<java.lang.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).JsonSerializer<?>
findCollectionSerializer(SerializationConfig config, CollectionType type, BeanDescription beanDesc, TypeSerializer elementTypeSerializer, JsonSerializer<java.lang.Object> elementValueSerializer)
Method called by serialization framework first time a serializer is needed for specifiedCollection
type.JsonSerializer<?>
findMapLikeSerializer(SerializationConfig config, MapLikeType type, BeanDescription beanDesc, JsonSerializer<java.lang.Object> keySerializer, TypeSerializer elementTypeSerializer, JsonSerializer<java.lang.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).JsonSerializer<?>
findMapSerializer(SerializationConfig config, MapType type, BeanDescription beanDesc, JsonSerializer<java.lang.Object> keySerializer, TypeSerializer elementTypeSerializer, JsonSerializer<java.lang.Object> elementValueSerializer)
Method called by serialization framework first time a serializer is needed for specifiedMap
type.JsonSerializer<?>
findReferenceSerializer(SerializationConfig config, ReferenceType type, BeanDescription beanDesc, TypeSerializer contentTypeSerializer, JsonSerializer<java.lang.Object> contentValueSerializer)
Method called by serialization framework first time a serializer is needed for givenReferenceType
JsonSerializer<?>
findSerializer(SerializationConfig config, JavaType type, BeanDescription beanDesc)
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).
-
-
-
Method Detail
-
findSerializer
JsonSerializer<?> findSerializer(SerializationConfig config, JavaType type, BeanDescription beanDesc)
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).- Parameters:
type
- Fully resolved type of instances to serializeconfig
- Serialization configuration in usebeanDesc
- Additional information about type- Returns:
- Configured serializer to use for the type; or null if implementation does not recognize or support type
-
findReferenceSerializer
JsonSerializer<?> findReferenceSerializer(SerializationConfig config, ReferenceType type, BeanDescription beanDesc, TypeSerializer contentTypeSerializer, JsonSerializer<java.lang.Object> contentValueSerializer)
Method called by serialization framework first time a serializer is needed for givenReferenceType
- Since:
- 2.7
-
findArraySerializer
JsonSerializer<?> findArraySerializer(SerializationConfig config, ArrayType type, BeanDescription beanDesc, TypeSerializer elementTypeSerializer, JsonSerializer<java.lang.Object> elementValueSerializer)
Method 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.
-
findCollectionSerializer
JsonSerializer<?> findCollectionSerializer(SerializationConfig config, CollectionType type, BeanDescription beanDesc, TypeSerializer elementTypeSerializer, JsonSerializer<java.lang.Object> elementValueSerializer)
Method called by serialization framework first time a serializer is needed for specifiedCollection
type. Implementation should return a serializer instance if it supports specified type; or null if it does not.
-
findCollectionLikeSerializer
JsonSerializer<?> findCollectionLikeSerializer(SerializationConfig config, CollectionLikeType type, BeanDescription beanDesc, TypeSerializer elementTypeSerializer, JsonSerializer<java.lang.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). Implementation should return a serializer instance if it supports specified type; or null if it does not.
-
findMapSerializer
JsonSerializer<?> findMapSerializer(SerializationConfig config, MapType type, BeanDescription beanDesc, JsonSerializer<java.lang.Object> keySerializer, TypeSerializer elementTypeSerializer, JsonSerializer<java.lang.Object> elementValueSerializer)
Method called by serialization framework first time a serializer is needed for specifiedMap
type. Implementation should return a serializer instance if it supports specified type; or null if it does not.
-
findMapLikeSerializer
JsonSerializer<?> findMapLikeSerializer(SerializationConfig config, MapLikeType type, BeanDescription beanDesc, JsonSerializer<java.lang.Object> keySerializer, TypeSerializer elementTypeSerializer, JsonSerializer<java.lang.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). Implementation should return a serializer instance if it supports specified type; or null if it does not.
-
-