use of com.google.inject.assistedinject.FactoryModuleBuilder in project graylog2-server by Graylog2.
the class Graylog2Module method installLookupCache.
protected void installLookupCache(String name, Class<? extends LookupCache> cacheClass, Class<? extends LookupCache.Factory> factoryClass, Class<? extends LookupCacheConfiguration> configClass) {
install(new FactoryModuleBuilder().implement(LookupCache.class, cacheClass).build(factoryClass));
lookupCacheBinder().addBinding(name).to(factoryClass);
registerJacksonSubtype(configClass, name);
}
use of com.google.inject.assistedinject.FactoryModuleBuilder in project graylog2-server by Graylog2.
the class Graylog2Module method installInput.
protected <T extends MessageInput> void installInput(MapBinder<String, MessageInput.Factory<? extends MessageInput>> inputMapBinder, Class<T> target, Class<? extends MessageInput.Factory<T>> targetFactory) {
install(new FactoryModuleBuilder().implement(MessageInput.class, target).build(targetFactory));
inputMapBinder.addBinding(target.getCanonicalName()).to(Key.get(targetFactory));
}
use of com.google.inject.assistedinject.FactoryModuleBuilder in project graylog2-server by Graylog2.
the class PluginModule method addEventFieldValueProvider.
protected void addEventFieldValueProvider(String name, Class<? extends FieldValueProvider> fieldValueProviderClass, Class<? extends FieldValueProvider.Factory> factoryClass, Class<? extends FieldValueProvider.Config> configClass) {
install(new FactoryModuleBuilder().implement(FieldValueProvider.class, fieldValueProviderClass).build(factoryClass));
eventFieldValueProviderBinder().addBinding(name).to(factoryClass);
registerJacksonSubtype(configClass, name);
}
use of com.google.inject.assistedinject.FactoryModuleBuilder in project graylog2-server by Graylog2.
the class PluginModule method addAuthServiceBackend.
protected void addAuthServiceBackend(String name, Class<? extends AuthServiceBackend> backendClass, Class<? extends AuthServiceBackend.Factory<? extends AuthServiceBackend>> factoryClass, Class<? extends AuthServiceBackendConfig> configClass) {
install(new FactoryModuleBuilder().implement(AuthServiceBackend.class, backendClass).build(factoryClass));
authServiceBackendBinder().addBinding(name).to(factoryClass);
registerJacksonSubtype(configClass, name);
}
use of com.google.inject.assistedinject.FactoryModuleBuilder in project gerrit by GerritCodeReview.
the class AbstractIndexModule method configure.
@Override
protected void configure() {
if (slave) {
bind(AccountIndex.Factory.class).toInstance(s -> {
throw new UnsupportedOperationException();
});
bind(ChangeIndex.Factory.class).toInstance(s -> {
throw new UnsupportedOperationException();
});
bind(ProjectIndex.Factory.class).toInstance(s -> {
throw new UnsupportedOperationException();
});
} else {
install(new FactoryModuleBuilder().implement(AccountIndex.class, getAccountIndex()).build(AccountIndex.Factory.class));
install(new FactoryModuleBuilder().implement(ChangeIndex.class, getChangeIndex()).build(ChangeIndex.Factory.class));
install(new FactoryModuleBuilder().implement(ProjectIndex.class, getProjectIndex()).build(ProjectIndex.Factory.class));
}
install(new FactoryModuleBuilder().implement(GroupIndex.class, getGroupIndex()).build(GroupIndex.Factory.class));
install(new IndexModule(threads, slave));
if (singleVersions == null) {
install(new MultiVersionModule());
} else {
install(new SingleVersionModule(singleVersions));
}
}
Aggregations