public class AnnotatedJacksonModule
extends com.google.inject.AbstractModule
ObjectMapper
.
This module provides the ObjectMapper
in the context of the given
BindingAnnotation
.
With this module installed, you can add new Jackson modules
to the
ObjectMapper
by adding bindings of Module
using the Multibinder.
Example:
class MyModule extends AbstractModule {
{@literal @}Override
protected void configure() {
Multibinder<Module> jacksonModuleBinder = Multibinder
.newSetBinder(binder(), Module.class, MyBindingAnnotation.class);
jacksonModuleBinder.addBinding().to(FoobarModule.class);
}
}
Binds:
ObjectMapper
annotated with the given
clientBindingAnnotation
JacksonJsonProvider
annotated with the given
clientBindingAnnotation
via a guice provider
ObjectMapperClientProvider
Multibinder
for SerializationFeatureFlag
annotated with
clientBindingAnnotation
Multibinder
for DeserializationFeatureFlag
annotated with
clientBindingAnnotation
Multibinder
for JsonGeneratorFeatureFlag
annotated with
clientBindingAnnotation
Multibinder
for JsonParserFeatureFlag
annotated with
clientBindingAnnotation
Multibinder
for MapperFeatureFlag
annotated with
clientBindingAnnotation
Installs:
MultibindingsScanner
This module also creates a new SetBinders for the following types annotated with the given
BindingAnnotation
JacksonModule
Modifier and Type | Method and Description |
---|---|
protected void |
configure() |
static AnnotatedJacksonModule |
with(Class<? extends Annotation> clientBindingAnnotation)
A static method to create an instance of
AnnotatedJacksonModule . |
addError, addError, addError, bind, bind, bind, bindConstant, binder, bindInterceptor, bindListener, bindListener, bindScope, configure, convertToTypes, currentStage, getMembersInjector, getMembersInjector, getProvider, getProvider, install, requestInjection, requestStaticInjection, requireBinding, requireBinding
public static AnnotatedJacksonModule with(Class<? extends Annotation> clientBindingAnnotation)
AnnotatedJacksonModule
.clientBindingAnnotation
- a BindingAnnotation
to which the ObjectMapper
need to be annotated with.AnnotatedJacksonModule
protected void configure()
configure
in class com.google.inject.AbstractModule
Copyright © 2020 Cerner Innovation, Inc.. All rights reserved.