use of com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair in project druid by druid-io.
the class DruidSecondaryModule method setupJackson.
private void setupJackson(Injector injector, final ObjectMapper mapper) {
final GuiceAnnotationIntrospector guiceIntrospector = new GuiceAnnotationIntrospector();
mapper.setInjectableValues(new GuiceInjectableValues(injector));
mapper.setAnnotationIntrospectors(new AnnotationIntrospectorPair(guiceIntrospector, mapper.getSerializationConfig().getAnnotationIntrospector()), new AnnotationIntrospectorPair(guiceIntrospector, mapper.getDeserializationConfig().getAnnotationIntrospector()));
}
use of com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair in project druid by druid-io.
the class URIExtractionNamespaceTest method registerTypes.
public static ObjectMapper registerTypes(final ObjectMapper mapper) {
mapper.setInjectableValues(new GuiceInjectableValues(Guice.createInjector(ImmutableList.of(new Module() {
@Override
public void configure(Binder binder) {
binder.bind(ObjectMapper.class).annotatedWith(Json.class).toInstance(mapper);
binder.bind(ObjectMapper.class).toInstance(mapper);
}
})))).registerSubtypes(URIExtractionNamespace.class, URIExtractionNamespace.FlatDataParser.class);
final GuiceAnnotationIntrospector guiceIntrospector = new GuiceAnnotationIntrospector();
mapper.setAnnotationIntrospectors(new AnnotationIntrospectorPair(guiceIntrospector, mapper.getSerializationConfig().getAnnotationIntrospector()), new AnnotationIntrospectorPair(guiceIntrospector, mapper.getDeserializationConfig().getAnnotationIntrospector()));
return mapper;
}
use of com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair in project druid by druid-io.
the class LoadSpecTest method setUp.
@BeforeClass
public static void setUp() {
final Injector injector = GuiceInjectors.makeStartupInjectorWithModules(ImmutableList.of(new Module() {
@Override
public void configure(Binder binder) {
binder.bind(LocalDataSegmentPuller.class);
}
}));
mapper = new DefaultObjectMapper();
mapper.registerModule(new SimpleModule("loadSpecTest").registerSubtypes(LocalLoadSpec.class));
mapper.setInjectableValues(new GuiceInjectableValues(injector));
final GuiceAnnotationIntrospector guiceIntrospector = new GuiceAnnotationIntrospector();
mapper.setAnnotationIntrospectors(new AnnotationIntrospectorPair(guiceIntrospector, mapper.getSerializationConfig().getAnnotationIntrospector()), new AnnotationIntrospectorPair(guiceIntrospector, mapper.getDeserializationConfig().getAnnotationIntrospector()));
}
use of com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair in project druid by druid-io.
the class IngestSegmentFirehoseFactoryTest method setupInjectablesInObjectMapper.
public static ObjectMapper setupInjectablesInObjectMapper(ObjectMapper objectMapper) {
objectMapper.registerModule(new SimpleModule("testModule").registerSubtypes(LocalLoadSpec.class));
final GuiceAnnotationIntrospector guiceIntrospector = new GuiceAnnotationIntrospector();
objectMapper.setAnnotationIntrospectors(new AnnotationIntrospectorPair(guiceIntrospector, objectMapper.getSerializationConfig().getAnnotationIntrospector()), new AnnotationIntrospectorPair(guiceIntrospector, objectMapper.getDeserializationConfig().getAnnotationIntrospector()));
objectMapper.setInjectableValues(new GuiceInjectableValues(GuiceInjectors.makeStartupInjectorWithModules(ImmutableList.of(new Module() {
@Override
public void configure(Binder binder) {
binder.bind(LocalDataSegmentPuller.class);
}
}))));
return objectMapper;
}
use of com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair in project platformlayer by platformlayer.
the class JsonHelper method buildObjectMapper.
public static ObjectMapper buildObjectMapper(TypeFactory typeFactory, boolean formatted) {
ObjectMapper mapper = new ObjectMapper();
if (typeFactory == null) {
typeFactory = TypeFactory.defaultInstance();
}
if (formatted) {
mapper.enable(SerializationFeature.INDENT_OUTPUT);
}
// Favor JAXB annotations
AnnotationIntrospector jaxbIntrospector = new JaxbAnnotationIntrospector(typeFactory);
AnnotationIntrospector jacksonIntrospector = new JacksonAnnotationIntrospector();
AnnotationIntrospector introspector = new AnnotationIntrospectorPair(jaxbIntrospector, jacksonIntrospector);
mapper.setAnnotationIntrospector(introspector);
return mapper;
}
Aggregations