Search in sources :

Example 1 with GuiceAnnotationIntrospector

use of io.druid.guice.GuiceAnnotationIntrospector 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;
}
Also used : AnnotationIntrospectorPair(com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair) Binder(com.google.inject.Binder) Module(com.google.inject.Module) GuiceAnnotationIntrospector(io.druid.guice.GuiceAnnotationIntrospector) GuiceInjectableValues(io.druid.guice.GuiceInjectableValues) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) DefaultObjectMapper(io.druid.jackson.DefaultObjectMapper)

Example 2 with GuiceAnnotationIntrospector

use of io.druid.guice.GuiceAnnotationIntrospector 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()));
}
Also used : AnnotationIntrospectorPair(com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair) Binder(com.google.inject.Binder) Injector(com.google.inject.Injector) DefaultObjectMapper(io.druid.jackson.DefaultObjectMapper) Module(com.google.inject.Module) SimpleModule(com.fasterxml.jackson.databind.module.SimpleModule) GuiceAnnotationIntrospector(io.druid.guice.GuiceAnnotationIntrospector) SimpleModule(com.fasterxml.jackson.databind.module.SimpleModule) GuiceInjectableValues(io.druid.guice.GuiceInjectableValues) BeforeClass(org.junit.BeforeClass)

Example 3 with GuiceAnnotationIntrospector

use of io.druid.guice.GuiceAnnotationIntrospector 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;
}
Also used : LocalLoadSpec(io.druid.segment.loading.LocalLoadSpec) AnnotationIntrospectorPair(com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair) Binder(com.google.inject.Binder) Module(com.google.inject.Module) SimpleModule(com.fasterxml.jackson.databind.module.SimpleModule) GuiceAnnotationIntrospector(io.druid.guice.GuiceAnnotationIntrospector) SimpleModule(com.fasterxml.jackson.databind.module.SimpleModule) GuiceInjectableValues(io.druid.guice.GuiceInjectableValues)

Aggregations

AnnotationIntrospectorPair (com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair)3 Binder (com.google.inject.Binder)3 Module (com.google.inject.Module)3 GuiceAnnotationIntrospector (io.druid.guice.GuiceAnnotationIntrospector)3 GuiceInjectableValues (io.druid.guice.GuiceInjectableValues)3 SimpleModule (com.fasterxml.jackson.databind.module.SimpleModule)2 DefaultObjectMapper (io.druid.jackson.DefaultObjectMapper)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 Injector (com.google.inject.Injector)1 LocalLoadSpec (io.druid.segment.loading.LocalLoadSpec)1 BeforeClass (org.junit.BeforeClass)1