Class SerializerFactory
- java.lang.Object
-
- com.fasterxml.jackson.databind.ser.SerializerFactory
-
- Direct Known Subclasses:
BasicSerializerFactory
public abstract class SerializerFactory extends java.lang.Object
Abstract class that defines API used bySerializerProvider
to obtain actualJsonSerializer
instances from multiple distinct factories.
-
-
Constructor Summary
Constructors Constructor Description SerializerFactory()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description abstract JsonSerializer<java.lang.Object>
createKeySerializer(SerializationConfig config, JavaType type, JsonSerializer<java.lang.Object> defaultImpl)
Deprecated.JsonSerializer<java.lang.Object>
createKeySerializer(SerializerProvider prov, JavaType type, JsonSerializer<java.lang.Object> defaultImpl)
Method called to create serializer to use for serializing JSON property names (which must be output asJsonToken.FIELD_NAME
) for Map that has specified declared key type, and is for specified property (or, if property is null, as root value)abstract JsonSerializer<java.lang.Object>
createSerializer(SerializerProvider prov, JavaType baseType)
Method called to create (or, for immutable serializers, reuse) a serializer for given type.abstract TypeSerializer
createTypeSerializer(SerializationConfig config, JavaType baseType)
Method called to create a type information serializer for given base type, if one is needed.abstract SerializerFactory
withAdditionalKeySerializers(Serializers additional)
abstract SerializerFactory
withAdditionalSerializers(Serializers additional)
Convenience method for creating a new factory instance with additional serializer provider; equivalent to callingabstract SerializerFactory
withSerializerModifier(BeanSerializerModifier modifier)
Convenience method for creating a new factory instance with additional bean serializer modifier; equivalent to calling
-
-
-
Method Detail
-
withAdditionalSerializers
public abstract SerializerFactory withAdditionalSerializers(Serializers additional)
Convenience method for creating a new factory instance with additional serializer provider; equivalent to callingwithConfig(getConfig().withAdditionalSerializers(additional));
-
withAdditionalKeySerializers
public abstract SerializerFactory withAdditionalKeySerializers(Serializers additional)
-
withSerializerModifier
public abstract SerializerFactory withSerializerModifier(BeanSerializerModifier modifier)
Convenience method for creating a new factory instance with additional bean serializer modifier; equivalent to callingwithConfig(getConfig().withSerializerModifier(modifier));
-
createSerializer
public abstract JsonSerializer<java.lang.Object> createSerializer(SerializerProvider prov, JavaType baseType) throws JsonMappingException
Method called to create (or, for immutable serializers, reuse) a serializer for given type.- Parameters:
prov
- Provider that needs to be used to resolve annotation-provided serializers (but NOT for others)- Throws:
JsonMappingException
- Since:
- 2.1 (earlier versions had method with different signature)
-
createTypeSerializer
public abstract TypeSerializer createTypeSerializer(SerializationConfig config, JavaType baseType) throws JsonMappingException
Method called to create a type information serializer for given base type, if one is needed. If not needed (no polymorphic handling configured), should return null.- Parameters:
baseType
- Declared type to use as the base type for type information serializer- Returns:
- Type serializer to use for the base type, if one is needed; null if not.
- Throws:
JsonMappingException
-
createKeySerializer
public JsonSerializer<java.lang.Object> createKeySerializer(SerializerProvider prov, JavaType type, JsonSerializer<java.lang.Object> defaultImpl) throws JsonMappingException
Method called to create serializer to use for serializing JSON property names (which must be output asJsonToken.FIELD_NAME
) for Map that has specified declared key type, and is for specified property (or, if property is null, as root value)- Parameters:
type
- Declared type for Map keysdefaultImpl
- Default key serializer implementation to use, if no custom ones are found (may be null)- Returns:
- Serializer to use, if factory knows it; null if not (in which case default serializer is to be used)
- Throws:
JsonMappingException
- Since:
- 2.11
-
createKeySerializer
@Deprecated public abstract JsonSerializer<java.lang.Object> createKeySerializer(SerializationConfig config, JavaType type, JsonSerializer<java.lang.Object> defaultImpl) throws JsonMappingException
Deprecated.- Throws:
JsonMappingException
-
-