- All Implemented Interfaces:
JacksonModule.SetupContext
JacksonModule.SetupContext
used by
ObjectMapper
.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final MapperBuilder<?,
?> protected final ConfigOverrides
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected DeserializerFactory
protected SerializerFactory
protected void
protected void
protected TokenStreamFactory
addAbstractTypeResolver
(AbstractTypeResolver resolver) Method that module can use to register additionalAbstractTypeResolver
instance, to handle resolution of abstract to concrete types (either by defaulting, or by materializing).Method that module can use to register additional modifier objects to customize configuration and construction of bean deserializers.Method that module can use to register additional deserializers to use for handling types.addHandler
(DeserializationProblemHandler handler) Add a deserialization problem handlerMethod that module can use to register additional deserializers to use for handling Map key values (which are separate from value deserializers because they are always serialized from String values)Method that module can use to register additional serializers to use for handling Map key values (which are separate from value serializers because they must writeJsonToken.FIELD_NAME
instead of String value).addSerializerModifier
(ValueSerializerModifier modifier) Method that module can use to register additional modifier objects to customize configuration and construction of bean serializers.Method that module can use to register additional serializers to use for handling types.addTypeModifier
(TypeModifier modifier) Method that module can use to register additionalTypeModifier
instance, which can augmentJavaType
instances constructed byTypeFactory
.addValueInstantiators
(ValueInstantiators instantiators) Method that module can use to register additionalValueInstantiator
s, by addingValueInstantiators
object that gets called when instantatiator is needed by a deserializer.Method for registering specifiedAnnotationIntrospector
as the lowest priority introspector, chained with existing introspector(s) and called as fallback for cases not otherwise handled.void
applyChanges
(MapperBuilder<?, ?> b) Method called after all changes have been applied through this context, to propagate buffered or pending changes (if any) back to builder.configOverride
(Class<?> type) "Mutant accessor" for getting a mutable configuration override object for given type, needed to add or change per-type overrides applied to properties of given type.Method that returns version information aboutObjectMapper
that implements this context.getOwner()
Fallback access method that allows modules to refer to theMapperBuilder
that provided this context.Method for registering specifiedAnnotationIntrospector
as the highest priority introspector (will be chained with existing introspector(s) which will be used as fallbacks for cases this introspector does not handle)boolean
boolean
boolean
boolean
boolean
boolean
boolean
Method that module can use to override handler called to write JSON Object key forMap
values.Method that module can use to override handler called to write Java `null` as a value (Property or Map value, Collection/array element).Replace defaultInjectableValues
that have been configured to be used for mapper being built.registerSubtypes
(Class<?>... subtypes) Method for registering specified classes as subtypes (of supertype(s) they have)registerSubtypes
(Collection<Class<?>> subtypes) Method for registering specified classes as subtypes (of supertype(s) they have)registerSubtypes
(NamedType... subtypes) Method for registering specified classes as subtypes (of supertype(s) they have), using specified type names.Method used for defining mix-in annotations to use for augmenting specified class or interface.Accessor for findingTypeFactory
that is currently configured by the context.
-
Field Details
-
_builder
-
_configOverrides
-
-
Constructor Details
-
ModuleContextBase
-
-
Method Details
-
applyChanges
Method called after all changes have been applied through this context, to propagate buffered or pending changes (if any) back to builder. Note that base implementation does nothing here; it is only provded in case sub-classes might need it. -
getMapperVersion
Description copied from interface:JacksonModule.SetupContext
Method that returns version information aboutObjectMapper
that implements this context. Modules can use this to choose different settings or initialization order; or even decide to fail set up completely if version is compatible with module.- Specified by:
getMapperVersion
in interfaceJacksonModule.SetupContext
-
getFormatName
- Specified by:
getFormatName
in interfaceJacksonModule.SetupContext
-
getOwner
Description copied from interface:JacksonModule.SetupContext
Fallback access method that allows modules to refer to theMapperBuilder
that provided this context. It should NOT be needed by most modules; and ideally should not be used -- however, there may be cases where this may be necessary due to various design constraints.NOTE: use of this method is discouraged, as it allows access to things Modules typically should not modify. It is included, however, to allow access to new features in cases where Module API has not yet been extended, or there are oversights.
Return value is chosen to force casting, to make caller aware that this is a fallback accessor, used only when everything else fails: type is, however, guaranteed to be
MapperBuilder
(and more specifically format-specific subtype that mapper constructed, in case format-specific access is needed).- Specified by:
getOwner
in interfaceJacksonModule.SetupContext
-
typeFactory
Description copied from interface:JacksonModule.SetupContext
Accessor for findingTypeFactory
that is currently configured by the context.NOTE: since it is possible that other modules might change or replace TypeFactory, use of this method adds order-dependency for registrations.
- Specified by:
typeFactory
in interfaceJacksonModule.SetupContext
-
tokenStreamFactory
- Specified by:
tokenStreamFactory
in interfaceJacksonModule.SetupContext
-
isEnabled
- Specified by:
isEnabled
in interfaceJacksonModule.SetupContext
-
isEnabled
- Specified by:
isEnabled
in interfaceJacksonModule.SetupContext
-
isEnabled
- Specified by:
isEnabled
in interfaceJacksonModule.SetupContext
-
isEnabled
- Specified by:
isEnabled
in interfaceJacksonModule.SetupContext
-
isEnabled
- Specified by:
isEnabled
in interfaceJacksonModule.SetupContext
-
isEnabled
- Specified by:
isEnabled
in interfaceJacksonModule.SetupContext
-
isEnabled
- Specified by:
isEnabled
in interfaceJacksonModule.SetupContext
-
datatypeFeatures
- Specified by:
datatypeFeatures
in interfaceJacksonModule.SetupContext
-
addDeserializers
Description copied from interface:JacksonModule.SetupContext
Method that module can use to register additional deserializers to use for handling types.- Specified by:
addDeserializers
in interfaceJacksonModule.SetupContext
- Parameters:
d
- Object that can be called to find deserializer for types supported by module (null returned for non-supported types)- See Also:
-
addKeyDeserializers
Description copied from interface:JacksonModule.SetupContext
Method that module can use to register additional deserializers to use for handling Map key values (which are separate from value deserializers because they are always serialized from String values)- Specified by:
addKeyDeserializers
in interfaceJacksonModule.SetupContext
-
addDeserializerModifier
Description copied from interface:JacksonModule.SetupContext
Method that module can use to register additional modifier objects to customize configuration and construction of bean deserializers.- Specified by:
addDeserializerModifier
in interfaceJacksonModule.SetupContext
- Parameters:
modifier
- Modifier to register
-
addValueInstantiators
Description copied from interface:JacksonModule.SetupContext
Method that module can use to register additionalValueInstantiator
s, by addingValueInstantiators
object that gets called when instantatiator is needed by a deserializer.- Specified by:
addValueInstantiators
in interfaceJacksonModule.SetupContext
- Parameters:
instantiators
- Object that can provideValueInstantiator
s for constructing POJO values during deserialization
-
addSerializers
Description copied from interface:JacksonModule.SetupContext
Method that module can use to register additional serializers to use for handling types.- Specified by:
addSerializers
in interfaceJacksonModule.SetupContext
- Parameters:
s
- Object that can be called to find serializer for types supported by module (null returned for non-supported types)- See Also:
-
addKeySerializers
Description copied from interface:JacksonModule.SetupContext
Method that module can use to register additional serializers to use for handling Map key values (which are separate from value serializers because they must writeJsonToken.FIELD_NAME
instead of String value).- Specified by:
addKeySerializers
in interfaceJacksonModule.SetupContext
-
addSerializerModifier
Description copied from interface:JacksonModule.SetupContext
Method that module can use to register additional modifier objects to customize configuration and construction of bean serializers.- Specified by:
addSerializerModifier
in interfaceJacksonModule.SetupContext
- Parameters:
modifier
- Modifier to register
-
overrideDefaultNullKeySerializer
Description copied from interface:JacksonModule.SetupContext
Method that module can use to override handler called to write JSON Object key forMap
values.- Specified by:
overrideDefaultNullKeySerializer
in interfaceJacksonModule.SetupContext
- Parameters:
ser
- Serializer called to write output for JSON Object key of which value on Java side is `null`
-
overrideDefaultNullValueSerializer
Description copied from interface:JacksonModule.SetupContext
Method that module can use to override handler called to write Java `null` as a value (Property or Map value, Collection/array element).- Specified by:
overrideDefaultNullValueSerializer
in interfaceJacksonModule.SetupContext
- Parameters:
ser
- Serializer called to write output for Java `null` as value (as distinct from key)
-
addAbstractTypeResolver
Description copied from interface:JacksonModule.SetupContext
Method that module can use to register additionalAbstractTypeResolver
instance, to handle resolution of abstract to concrete types (either by defaulting, or by materializing).- Specified by:
addAbstractTypeResolver
in interfaceJacksonModule.SetupContext
- Parameters:
resolver
- Resolver to add.
-
addTypeModifier
Description copied from interface:JacksonModule.SetupContext
Method that module can use to register additionalTypeModifier
instance, which can augmentJavaType
instances constructed byTypeFactory
.- Specified by:
addTypeModifier
in interfaceJacksonModule.SetupContext
- Parameters:
modifier
- to add
-
registerSubtypes
Description copied from interface:JacksonModule.SetupContext
Method for registering specified classes as subtypes (of supertype(s) they have)- Specified by:
registerSubtypes
in interfaceJacksonModule.SetupContext
-
registerSubtypes
Description copied from interface:JacksonModule.SetupContext
Method for registering specified classes as subtypes (of supertype(s) they have), using specified type names.- Specified by:
registerSubtypes
in interfaceJacksonModule.SetupContext
-
registerSubtypes
Description copied from interface:JacksonModule.SetupContext
Method for registering specified classes as subtypes (of supertype(s) they have)- Specified by:
registerSubtypes
in interfaceJacksonModule.SetupContext
-
insertAnnotationIntrospector
Description copied from interface:JacksonModule.SetupContext
Method for registering specifiedAnnotationIntrospector
as the highest priority introspector (will be chained with existing introspector(s) which will be used as fallbacks for cases this introspector does not handle)- Specified by:
insertAnnotationIntrospector
in interfaceJacksonModule.SetupContext
- Parameters:
ai
- Annotation introspector to register.
-
appendAnnotationIntrospector
Description copied from interface:JacksonModule.SetupContext
Method for registering specifiedAnnotationIntrospector
as the lowest priority introspector, chained with existing introspector(s) and called as fallback for cases not otherwise handled.- Specified by:
appendAnnotationIntrospector
in interfaceJacksonModule.SetupContext
- Parameters:
ai
- Annotation introspector to register.
-
configOverride
Description copied from interface:JacksonModule.SetupContext
"Mutant accessor" for getting a mutable configuration override object for given type, needed to add or change per-type overrides applied to properties of given type. Usage is through returned object by colling "setter" methods, which directly modify override object and take effect directly. For example you can domapper.configOverride(java.util.Date.class) .setFormat(JsonFormat.Value.forPattern("yyyy-MM-dd"));
to change the default format to use for properties of typeDate
(possibly further overridden by per-property annotations)- Specified by:
configOverride
in interfaceJacksonModule.SetupContext
-
addHandler
Description copied from interface:JacksonModule.SetupContext
Add a deserialization problem handler- Specified by:
addHandler
in interfaceJacksonModule.SetupContext
- Parameters:
handler
- The deserialization problem handler
-
overrideInjectableValues
Description copied from interface:JacksonModule.SetupContext
Replace defaultInjectableValues
that have been configured to be used for mapper being built.- Specified by:
overrideInjectableValues
in interfaceJacksonModule.SetupContext
-
setMixIn
Description copied from interface:JacksonModule.SetupContext
Method used for defining mix-in annotations to use for augmenting specified class or interface. All annotations frommixinSource
are taken to override annotations thattarget
(or its supertypes) has.Note: mix-ins are registered both for serialization and deserialization (which can be different internally).
Note: currently only one set of mix-in annotations can be defined for a single class; so if multiple modules register mix-ins, highest priority one (last one registered) will have priority over other modules.
- Specified by:
setMixIn
in interfaceJacksonModule.SetupContext
- Parameters:
target
- Class (or interface) whose annotations to effectively overridemixinSource
- Class (or interface) whose annotations are to be "added" to target's annotations, overriding as necessary
-
_streamFactory
-
_deserializerFactory
-
_set
-
_serializerFactory
-
_set
-