Top Description Constructors Methods
com.fasterxml.jackson.databind.cfg

public abstract Class HandlerInstantiator

extends Object
Class Inheritance
Imports
com.fasterxml.jackson.annotation.ObjectIdGenerator, .ObjectIdResolver, com.fasterxml.jackson.databind.*, com.fasterxml.jackson.databind.deser.ValueInstantiator, com.fasterxml.jackson.databind.introspect.Annotated, .BeanPropertyDefinition, com.fasterxml.jackson.databind.jsontype.TypeIdResolver, .TypeResolverBuilder, com.fasterxml.jackson.databind.ser.VirtualBeanPropertyWriter, com.fasterxml.jackson.databind.util.Converter

Helper class used for handling details of creating handler instances (things like JsonSerializers, JsonDeserializers, various type handlers) of specific types. Actual handler type has been resolved at this point, so instantiator is strictly responsible for providing a configured instance by constructing and configuring a new instance, or possibly by recycling a shared instance. One use case is that of allowing dependency injection, which would otherwise be difficult to do.

Custom instances are allowed to return null to indicate that caller should use the default instantiation handling (which just means calling no-argument constructor via reflection).

Care has to be taken to ensure that if instance returned is shared, it will be thread-safe; caller will not synchronize access to returned instances.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Converter<?, ?>
converterInstance(MapperConfig<?> config, Annotated annotated, Class<?> implClass)

Method called to construct a Converter instance used for specified class.

public abstract JsonDeserializer<?>

Returns:

Deserializer instance to use
deserializerInstance
(DeserializationConfig
Deserialization configuration in effect
config
,
Annotated
Element (Class, Method, Field, constructor parameter) that had annotation defining class of deserializer to construct (to allow implementation use information from other annotations)
annotated
,
Class<?>
Class of deserializer instance to return
deserClass
)

Method called to get an instance of deserializer of specified type.

public Object
includeFilterInstance(SerializationConfig config, BeanPropertyDefinition forProperty, Class<?> filterClass)

Method called to construct a Filter (any Object with implementation of equals(Object) that determines if given value is to be excluded (true) or included (false)) to be used based on com.fasterxml.jackson.annotation.JsonInclude annotation (or equivalent).

public abstract KeyDeserializer

Returns:

Key deserializer instance to use
keyDeserializerInstance
(DeserializationConfig
Deserialization configuration in effect
config
,
Annotated
Element (Class, Method, Field, constructor parameter) that had annotation defining class of key deserializer to construct (to allow implementation use information from other annotations)
annotated
,
Class<?>
Class of key deserializer instance to return
keyDeserClass
)

Method called to get an instance of key deserializer of specified type.

public PropertyNamingStrategy
namingStrategyInstance(MapperConfig<?> config, Annotated annotated, Class<?> implClass)

Method called to construct a NamingStrategy instance used for specified class.

public ObjectIdGenerator<?>
objectIdGeneratorInstance(MapperConfig<?> config, Annotated annotated, Class<?> implClass)

Method called to construct a ObjectIdHandler instance of specified type.

public ObjectIdResolver
resolverIdGeneratorInstance(MapperConfig<?> config, Annotated annotated, Class<?> implClass)

public abstract JsonSerializer<?>

Returns:

Serializer instance to use
serializerInstance
(SerializationConfig
Serialization configuration in effect
config
,
Annotated
Element (Class, Method, Field) that had annotation defining class of serializer to construct (to allow implementation use information from other annotations)
annotated
,
Class<?>
Class of serializer instance to return
serClass
)

Method called to get an instance of serializer of specified type.

public abstract TypeIdResolver

Returns:

TypeResolverBuilder instance to use
typeIdResolverInstance
(MapperConfig<?>
Mapper configuration in effect (either SerializationConfig or DeserializationConfig, depending on when instance is being constructed)
config
,
Annotated
annotated Element (Class, Method, Field) that had annotation defining class of resolver to construct (to allow implementation use information from other annotations)
annotated
,
Class<?>
Class of resolver instance to return
resolverClass
)

Method called to get an instance of TypeIdResolver of specified type.

public abstract TypeResolverBuilder<?>

Returns:

TypeResolverBuilder instance to use
typeResolverBuilderInstance
(MapperConfig<?>
Mapper configuration in effect (either SerializationConfig or DeserializationConfig, depending on when instance is being constructed)
config
,
Annotated
annotated Element (Class, Method, Field) that had annotation defining class of builder to construct (to allow implementation use information from other annotations)
annotated
,
Class<?>
Class of builder instance to return
builderClass
)

Method called to get an instance of TypeResolverBuilder of specified type.

public ValueInstantiator
valueInstantiatorInstance(MapperConfig<?> config, Annotated annotated, Class<?> resolverClass)

Method called to construct an instance of ValueInstantiator of specified type.

public VirtualBeanPropertyWriter
virtualPropertyWriterInstance(MapperConfig<?> config, Class<?> implClass)

Method called to construct a VirtualBeanPropertyWriter instance of specified type.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

HandlerInstantiatorback to summary
public HandlerInstantiator()

Method Detail

converterInstanceback to summary
public Converter<?, ?> converterInstance(MapperConfig<?> config, Annotated annotated, Class<?> implClass)

Method called to construct a Converter instance used for specified class.

Since
2.2
deserializerInstanceback to summary
public abstract JsonDeserializer<?> deserializerInstance(DeserializationConfig config, Annotated annotated, Class<?> deserClass)

Method called to get an instance of deserializer of specified type.

Parameters
config:DeserializationConfig

Deserialization configuration in effect

annotated:Annotated

Element (Class, Method, Field, constructor parameter) that had annotation defining class of deserializer to construct (to allow implementation use information from other annotations)

deserClass:Class<?>

Class of deserializer instance to return

Returns:JsonDeserializer<?>

Deserializer instance to use

includeFilterInstanceback to summary
public Object includeFilterInstance(SerializationConfig config, BeanPropertyDefinition forProperty, Class<?> filterClass)

Method called to construct a Filter (any Object with implementation of equals(Object) that determines if given value is to be excluded (true) or included (false)) to be used based on com.fasterxml.jackson.annotation.JsonInclude annotation (or equivalent).

Default implementation returns `null` to indicate that default instantiation (use zero-arg constructor of the filterClass) should be used.

Since
2.9
keyDeserializerInstanceback to summary
public abstract KeyDeserializer keyDeserializerInstance(DeserializationConfig config, Annotated annotated, Class<?> keyDeserClass)

Method called to get an instance of key deserializer of specified type.

Parameters
config:DeserializationConfig

Deserialization configuration in effect

annotated:Annotated

Element (Class, Method, Field, constructor parameter) that had annotation defining class of key deserializer to construct (to allow implementation use information from other annotations)

keyDeserClass:Class<?>

Class of key deserializer instance to return

Returns:KeyDeserializer

Key deserializer instance to use

namingStrategyInstanceback to summary
public PropertyNamingStrategy namingStrategyInstance(MapperConfig<?> config, Annotated annotated, Class<?> implClass)

Method called to construct a NamingStrategy instance used for specified class.

Since
2.1
objectIdGeneratorInstanceback to summary
public ObjectIdGenerator<?> objectIdGeneratorInstance(MapperConfig<?> config, Annotated annotated, Class<?> implClass)

Method called to construct a ObjectIdHandler instance of specified type.

Since
2.0
resolverIdGeneratorInstanceback to summary
public ObjectIdResolver resolverIdGeneratorInstance(MapperConfig<?> config, Annotated annotated, Class<?> implClass)
serializerInstanceback to summary
public abstract JsonSerializer<?> serializerInstance(SerializationConfig config, Annotated annotated, Class<?> serClass)

Method called to get an instance of serializer of specified type.

Parameters
config:SerializationConfig

Serialization configuration in effect

annotated:Annotated

Element (Class, Method, Field) that had annotation defining class of serializer to construct (to allow implementation use information from other annotations)

serClass:Class<?>

Class of serializer instance to return

Returns:JsonSerializer<?>

Serializer instance to use

typeIdResolverInstanceback to summary
public abstract TypeIdResolver typeIdResolverInstance(MapperConfig<?> config, Annotated annotated, Class<?> resolverClass)

Method called to get an instance of TypeIdResolver of specified type.

Parameters
config:MapperConfig<?>

Mapper configuration in effect (either SerializationConfig or DeserializationConfig, depending on when instance is being constructed)

annotated:Annotated

annotated Element (Class, Method, Field) that had annotation defining class of resolver to construct (to allow implementation use information from other annotations)

resolverClass:Class<?>

Class of resolver instance to return

Returns:TypeIdResolver

TypeResolverBuilder instance to use

typeResolverBuilderInstanceback to summary
public abstract TypeResolverBuilder<?> typeResolverBuilderInstance(MapperConfig<?> config, Annotated annotated, Class<?> builderClass)

Method called to get an instance of TypeResolverBuilder of specified type.

Parameters
config:MapperConfig<?>

Mapper configuration in effect (either SerializationConfig or DeserializationConfig, depending on when instance is being constructed)

annotated:Annotated

annotated Element (Class, Method, Field) that had annotation defining class of builder to construct (to allow implementation use information from other annotations)

builderClass:Class<?>

Class of builder instance to return

Returns:TypeResolverBuilder<?>

TypeResolverBuilder instance to use

valueInstantiatorInstanceback to summary
public ValueInstantiator valueInstantiatorInstance(MapperConfig<?> config, Annotated annotated, Class<?> resolverClass)

Method called to construct an instance of ValueInstantiator of specified type.

virtualPropertyWriterInstanceback to summary
public VirtualBeanPropertyWriter virtualPropertyWriterInstance(MapperConfig<?> config, Class<?> implClass)

Method called to construct a VirtualBeanPropertyWriter instance of specified type.

Since
2.5