ObjectMapper
to provide a well-defined set of extensions to default functionality; such as
support for new data types.Note
was named just Module in Jackson 2.x but renamed due to naming
conflict with Java 9+ java.
| Modifier and Type | Class and Description |
|---|---|
| public static interface | JacksonModule.
Interface Jackson exposes to modules for purpose of registering extended functionality. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public Iterable | |
| public abstract String | getModuleName()
Method that returns a display that can be used by Jackson for informational purposes, as well as in associating extensions with module that provides them. |
| public Object | getRegistrationId()
Method that returns an id that may be used to determine if two
Default implementation returns value of class name ( |
| public abstract void | setupModule(JacksonModule.
Method called by |
| public abstract Version | version()
Redeclares tools. Method that returns version of this module. |
| JacksonModule | back to summary |
|---|---|
| public JacksonModule() | |
| getDependencies | back to summary |
|---|---|
| public Iterable Returns the list of dependent modules this module has, if any. It is called to let modules register other modules as dependencies. Modules returned will be registered before this module is registered, in iteration order. | |
| getModuleName | back to summary |
|---|---|
| public abstract String getModuleName() Method that returns a display that can be used by Jackson for informational purposes, as well as in associating extensions with module that provides them. | |
| getRegistrationId | back to summary |
|---|---|
| public Object getRegistrationId() Method that returns an id that may be used to determine if two
Default implementation returns value of class name (
| |
| setupModule | back to summary |
|---|---|
| public abstract void setupModule(JacksonModule. Method called by | |
| version | back to summary |
|---|---|
| public abstract Version version() Redeclares tools. Method that returns version of this module. Can be used by Jackson for informational purposes.
| |
ObjectMapper, but modules should
NOT rely on this -- if they do require access to mapper instance,
they need to call SetupContext#getOwner method.
| Modifier and Type | Method and Description |
|---|---|
| public JacksonModule. | addAbstractTypeResolver(AbstractTypeResolver
Resolver to add. resolver)Method that module can use to register additional
|
| public JacksonModule. | addDeserializerModifier(ValueDeserializerModifier
Modifier to register mod)Method that module can use to register additional modifier objects to customize configuration and construction of bean deserializers. |
| public JacksonModule. | addDeserializers(Deserializers
Object that can be called to find deserializer for types supported
by module (null returned for non-supported types) d)Method that module can use to register additional deserializers to use for handling types. |
| public JacksonModule. | addHandler(DeserializationProblemHandler
The deserialization problem handler handler)Add a deserialization problem handler |
| public JacksonModule. | addKeyDeserializers(KeyDeserializers s)
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) |
| public JacksonModule. | addKeySerializers(Serializers s)
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 write |
| public JacksonModule. | addSerializerModifier(ValueSerializerModifier
Modifier to register mod)Method that module can use to register additional modifier objects to customize configuration and construction of bean serializers. |
| public JacksonModule. | addSerializers(Serializers
Object that can be called to find serializer for types supported
by module (null returned for non-supported types) s)Method that module can use to register additional serializers to use for handling types. |
| public JacksonModule. | addTypeModifier(TypeModifier
to add modifier)Method that module can use to register additional
|
| public JacksonModule. | addValueInstantiators(ValueInstantiators
Object that can provide instantiators)tools.s for
constructing POJO values during deserializationMethod that module can use to register additional |
| public JacksonModule. | appendAnnotationIntrospector(AnnotationIntrospector
Annotation introspector to register. ai)Method for registering specified |
| public MutableConfigOverride | 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. |
| public DatatypeFeatures | |
| public String | |
| public Version | getMapperVersion()
Method that returns version information about |
| public Object | getOwner()
Fallback access method that allows modules to refer to the
|
| public JacksonModule. | insertAnnotationIntrospector(AnnotationIntrospector
Annotation introspector to register. ai)Method for registering specified |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public JacksonModule. | overrideDefaultNullKeySerializer(ValueSerializer<?>
Serializer called to write output for JSON Object key of which value
on Java side is `null` ser)Method that module can use to override handler called to write JSON Object key
for |
| public JacksonModule. | overrideDefaultNullValueSerializer(ValueSerializer<?>
Serializer called to write output for Java `null` as value (as
distinct from key) ser)Method that module can use to override handler called to write Java `null` as a value (Property or Map value, Collection/array element). |
| public JacksonModule. | overrideInjectableValues(UnaryOperator<InjectableValues> v)
Replace default |
| public JacksonModule. | registerSubtypes(Class<?>... subtypes)
Method for registering specified classes as subtypes (of supertype(s) they have) |
| public JacksonModule. | registerSubtypes(NamedType... subtypes)
Method for registering specified classes as subtypes (of supertype(s) they have), using specified type names. |
| public JacksonModule. | registerSubtypes(Collection<Class<?>> subtypes)
Method for registering specified classes as subtypes (of supertype(s) they have) |
| public JacksonModule. | setMixIn(Class<?>
Class (or interface) whose annotations to effectively override target, Class<?> Class (or interface) whose annotations are to
be "added" to target's annotations, overriding as necessary mixinSource)Method used for defining mix-in annotations to use for augmenting specified class or interface. |
| public TokenStreamFactory | |
| public TypeFactory |
| addAbstractTypeResolver | back to summary |
|---|---|
| public JacksonModule. Method that module can use to register additional
| |
| addDeserializerModifier | back to summary |
|---|---|
| public JacksonModule. Method that module can use to register additional modifier objects to customize configuration and construction of bean deserializers.
| |
| addDeserializers | back to summary |
|---|---|
| public JacksonModule. Method that module can use to register additional deserializers to use for handling types.
| |
| addHandler | back to summary |
|---|---|
| public JacksonModule. Add a deserialization problem handler
| |
| addKeyDeserializers | back to summary |
|---|---|
| public JacksonModule. 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) | |
| addKeySerializers | back to summary |
|---|---|
| public JacksonModule. 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 write | |
| addSerializerModifier | back to summary |
|---|---|
| public JacksonModule. Method that module can use to register additional modifier objects to customize configuration and construction of bean serializers.
| |
| addSerializers | back to summary |
|---|---|
| public JacksonModule. Method that module can use to register additional serializers to use for handling types.
| |
| addTypeModifier | back to summary |
|---|---|
| public JacksonModule. Method that module can use to register additional
| |
| addValueInstantiators | back to summary |
|---|---|
| public JacksonModule. Method that module can use to register additional
| |
| appendAnnotationIntrospector | back to summary |
|---|---|
| public JacksonModule. Method for registering specified
| |
| configOverride | back to summary |
|---|---|
| public MutableConfigOverride 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. Usage is through returned object by colling "setter" methods, which directly modify override object and take effect directly. For example you can do
mapper.configOverride(java.util.Date.class)
.setFormat(JsonFormat.Value.forPattern("yyyy-MM-dd"));
to change the default format to use for properties of type
java. (possibly further overridden by per-property
annotations)
| |
| datatypeFeatures | back to summary |
|---|---|
| public DatatypeFeatures datatypeFeatures() | |
| getFormatName | back to summary |
|---|---|
public String getFormatName()
| |
| getMapperVersion | back to summary |
|---|---|
| public Version getMapperVersion() Method that returns version information about | |
| getOwner | back to summary |
|---|---|
| public Object getOwner() Fallback access method that allows modules to refer to the
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 | |
| insertAnnotationIntrospector | back to summary |
|---|---|
| public JacksonModule. Method for registering specified
| |
| isEnabled | back to summary |
|---|---|
| public boolean isEnabled(MapperFeature f) | |
| isEnabled | back to summary |
|---|---|
| public boolean isEnabled(DeserializationFeature f) | |
| isEnabled | back to summary |
|---|---|
| public boolean isEnabled(SerializationFeature f) | |
| isEnabled | back to summary |
|---|---|
| public boolean isEnabled(TokenStreamFactory. | |
| isEnabled | back to summary |
|---|---|
| public boolean isEnabled(StreamReadFeature f) | |
| isEnabled | back to summary |
|---|---|
| public boolean isEnabled(StreamWriteFeature f) | |
| isEnabled | back to summary |
|---|---|
| public boolean isEnabled(DatatypeFeature f) | |
| overrideDefaultNullKeySerializer | back to summary |
|---|---|
| public JacksonModule. Method that module can use to override handler called to write JSON Object key
for
| |
| overrideDefaultNullValueSerializer | back to summary |
|---|---|
| public JacksonModule. Method that module can use to override handler called to write Java `null` as a value (Property or Map value, Collection/array element).
| |
| overrideInjectableValues | back to summary |
|---|---|
| public JacksonModule. Replace default
| |
| registerSubtypes | back to summary |
|---|---|
| public JacksonModule. Method for registering specified classes as subtypes (of supertype(s) they have) | |
| registerSubtypes | back to summary |
|---|---|
| public JacksonModule. Method for registering specified classes as subtypes (of supertype(s) they have), using specified type names. | |
| registerSubtypes | back to summary |
|---|---|
| public JacksonModule. Method for registering specified classes as subtypes (of supertype(s) they have) | |
| setMixIn | back to summary |
|---|---|
| public JacksonModule. Method used for defining mix-in annotations to use for augmenting
specified class or interface.
All annotations from
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. | |
| tokenStreamFactory | back to summary |
|---|---|
| public TokenStreamFactory tokenStreamFactory() | |
| typeFactory | back to summary |
|---|---|
| public TypeFactory typeFactory() Accessor for finding Note since it is possible that other modules might change or replace TypeFactory, use of this method adds order-dependency for registrations. | |