本文整理汇总了Java中com.google.inject.multibindings.MapBinder.newMapBinder方法的典型用法代码示例。如果您正苦于以下问题:Java MapBinder.newMapBinder方法的具体用法?Java MapBinder.newMapBinder怎么用?Java MapBinder.newMapBinder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.inject.multibindings.MapBinder
的用法示例。
在下文中一共展示了MapBinder.newMapBinder方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerInput
import com.google.inject.multibindings.MapBinder; //导入方法依赖的package包/类
public void registerInput(String type,
Class<? extends Input> inputClass,
Class<? extends Input.Factory<? extends Input, ? extends InputConfiguration>> inputFactoryClass,
Class<? extends InputConfiguration> inputConfigurationClass,
Class<? extends InputConfiguration.Factory<? extends InputConfiguration>> inputConfigurationFactoryClass) {
if (inputsMapBinder == null) {
this.inputsMapBinder = MapBinder.newMapBinder(binder(),
TypeLiteral.get(String.class),
new TypeLiteral<InputConfiguration.Factory<? extends InputConfiguration>>() {
});
}
install(new FactoryModuleBuilder().implement(Input.class, inputClass).build(inputFactoryClass));
install(new FactoryModuleBuilder().implement(Configuration.class, inputConfigurationClass).build(inputConfigurationFactoryClass));
inputsMapBinder.addBinding(type).to(inputConfigurationFactoryClass);
}
示例2: registerOutput
import com.google.inject.multibindings.MapBinder; //导入方法依赖的package包/类
public void registerOutput(String type,
Class<? extends Output> outputClass,
Class<? extends Output.Factory<? extends Output, ? extends OutputConfiguration>> outputFactoryClass,
Class<? extends OutputConfiguration> outputConfigurationClass,
Class<? extends OutputConfiguration.Factory<? extends OutputConfiguration>> outputConfigurationFactoryClass) {
if (outputsMapBinder == null) {
this.outputsMapBinder = MapBinder.newMapBinder(binder(),
TypeLiteral.get(String.class),
new TypeLiteral<OutputConfiguration.Factory<? extends OutputConfiguration>>() {
});
}
install(new FactoryModuleBuilder().implement(Output.class, outputClass).build(outputFactoryClass));
install(new FactoryModuleBuilder().implement(Configuration.class, outputConfigurationClass).build(outputConfigurationFactoryClass));
outputsMapBinder.addBinding(type).to(outputConfigurationFactoryClass);
}
示例3: configure
import com.google.inject.multibindings.MapBinder; //导入方法依赖的package包/类
@Override
protected void configure() {
bind(Parameters.class).toInstance(params);
// declare that people can provide scoring observer plugins, even though none are
// provided by default
MapBinder.newMapBinder(binder(), TypeLiteral.get(String.class),
new TypeLiteral<ScoringEventObserver<DocLevelEventArg, DocLevelEventArg>>() {
});
try {
bind(EREToKBPEventOntologyMapper.class)
.toInstance(EREToKBPEventOntologyMapper.create2016Mapping());
} catch (IOException ioe) {
throw new TACKBPEALException(ioe);
}
install(new ResponsesAndLinkingFromEREExtractor.Module());
install(new FactoryModuleBuilder()
.build(ResponsesAndLinkingFromKBPExtractorFactory.class));
}
示例4: configure
import com.google.inject.multibindings.MapBinder; //导入方法依赖的package包/类
@Override
protected void configure() {
bind(DuplicateMessageFilter.class).to(DuplicateMessageFilterImpl.class);
bind(MessageReceiver.class).to(MessageReceiverImpl.class);
bind(MessageSender.class).to(MessageSenderImpl.class);
bind(PostbackPayloadService.class).to(PostbackPayloadServiceImpl.class);
bind(SessionManager.class).to(InMemorySessionManagerImpl.class);
bind(InMemorySessionManager.class).to(InMemorySessionManagerImpl.class);
final MapBinder<Platform, PlatformMessageSender> platformMessageSenderBinder = MapBinder.newMapBinder(binder(),
Platform.class, PlatformMessageSender.class);
platformMessageSenderBinder.addBinding(FacebookPlatformEnum.FACEBOOK).to(FacebookMessageSenderImpl.class);
platformMessageSenderBinder.addBinding(SlackPlatformEnum.SLACK).to(SlackMessageSenderImpl.class);
platformMessageSenderBinder.addBinding(TelegramPlatformEnum.TELEGRAM).to(TelegramMessageSenderImpl.class);
platformMessageSenderBinder.addBinding(AlexaPlatformEnum.ALEXA).to(AlexaMessageSenderImpl.class);
platformMessageSenderBinder.addBinding(ApiAiPlatformEnum.APIAI).to(ApiAiMessageSenderImpl.class);
}
示例5: configure
import com.google.inject.multibindings.MapBinder; //导入方法依赖的package包/类
@Override
protected void configure() {
install(new JavaEngineModule());
bind(ViewRegistry.class).toInstance(new ViewRegistry() {
@Override
public OperatorNode<SequenceOperator> getView(List<String> name) {
return null;
}
});
bind(TaskMetricEmitter.class).toInstance(
new DummyStandardRequestEmitter(new MetricDimension(), new RequestMetricSink() {
@Override
public void emitRequest(final RequestEvent arg0) {
}
}).start("program", "program"));
MapBinder<String, Source> sourceBindings = MapBinder.newMapBinder(binder(), String.class, Source.class);
sourceBindings.addBinding("stocks").toInstance(new StockSource());
sourceBindings.addBinding("putStock").toInstance(new StockPutSource());
sourceBindings.addBinding("updateStocks").toInstance(new StockUpdateSource());
}
示例6: configure
import com.google.inject.multibindings.MapBinder; //导入方法依赖的package包/类
@Override
protected void configure() {
install(new JavaEngineModule());
bind(ViewRegistry.class).toInstance(new ViewRegistry() {
@Override
public OperatorNode<SequenceOperator> getView(List<String> name) {
return null;
}
});
bind(TaskMetricEmitter.class).toInstance(
new DummyStandardRequestEmitter(new MetricDimension(), new RequestMetricSink() {
@Override
public void emitRequest(final RequestEvent arg0) {
}
}).start("program", "program"));
MapBinder<String, Source> sourceBindings = MapBinder.newMapBinder(binder(), String.class, Source.class);
sourceBindings.addBinding("weather").toInstance(new WeatherSource());
sourceBindings.addBinding("geo").toInstance(new GeoSource());
}
示例7: configure
import com.google.inject.multibindings.MapBinder; //导入方法依赖的package包/类
@Override
protected void configure() {
bind(IBehaviorDeserialization.class).to(BehaviorDeserialization.class).in(Scopes.SINGLETON);
MapBinder<String, ILifecycleTask> lifecycleTaskPlugins
= MapBinder.newMapBinder(binder(), String.class, ILifecycleTask.class);
lifecycleTaskPlugins.addBinding("ai.labs.behavior").to(BehaviorRulesEvaluationTask.class);
MapBinder<String, IBehaviorExtension> behaviorExtensionPlugins
= MapBinder.newMapBinder(binder(), String.class, IBehaviorExtension.class);
behaviorExtensionPlugins.addBinding("ai.labs.behavior.extension.inputmatcher").
to(InputMatcher.class);
behaviorExtensionPlugins.addBinding("ai.labs.behavior.extension.actionmatcher").
to(ActionMatcher.class);
behaviorExtensionPlugins.addBinding("ai.labs.behavior.extension.contextmatcher").
to(ContextMatcher.class);
behaviorExtensionPlugins.addBinding("ai.labs.behavior.extension.connector").
to(Connector.class);
behaviorExtensionPlugins.addBinding("ai.labs.behavior.extension.dependency").
to(Dependency.class);
behaviorExtensionPlugins.addBinding("ai.labs.behavior.extension.negation").
to(Negation.class);
behaviorExtensionPlugins.addBinding("ai.labs.behavior.extension.occurrence").
to(Occurrence.class);
behaviorExtensionPlugins.addBinding("ai.labs.behavior.extension.resultsize").
to(ResultSize.class);
}
示例8: configure
import com.google.inject.multibindings.MapBinder; //导入方法依赖的package包/类
@Override
public void configure(Binder binder) {
BQCoreModule.extend(binder).addCommand(ExecCommand.class)
.addCommand(ListCommand.class)
.addCommand(ScheduleCommand.class);
// trigger extension points creation and provide default contributions
JobModuleExtender extender = JobModule.extend(binder).initAllExtensions();
jobTypes.forEach(extender::addJob);
// TODO: move this to extender API
MapBinder<LockType, LockHandler> lockHandlers = MapBinder.newMapBinder(binder, LockType.class,
LockHandler.class);
lockHandlers.addBinding(LockType.local).to(LocalLockHandler.class);
lockHandlers.addBinding(LockType.clustered).to(ZkClusterLockHandler.class);
}
示例9: configure
import com.google.inject.multibindings.MapBinder; //导入方法依赖的package包/类
@Override
protected void configure() {
bind(PermissionsService.class);
bind(SetPermissionsFilter.class);
bind(RemovePermissionsFilter.class);
bind(GetPermissionsFilter.class);
// Creates empty multibinder to avoid error during container starting
Multibinder.newSetBinder(
binder(), String.class, Names.named(SystemDomain.SYSTEM_DOMAIN_ACTIONS));
// initialize empty set binder
Multibinder.newSetBinder(binder(), AccountPermissionsChecker.class);
MapBinder.newMapBinder(binder(), String.class, SetPermissionsChecker.class);
MapBinder.newMapBinder(binder(), String.class, RemovePermissionsChecker.class);
}
示例10: configure
import com.google.inject.multibindings.MapBinder; //导入方法依赖的package包/类
@Override
protected void configure() {
MapBinder<String, InternalEnvironmentFactory> factories =
MapBinder.newMapBinder(binder(), String.class, InternalEnvironmentFactory.class);
factories.addBinding(OpenShiftEnvironment.TYPE).to(OpenShiftEnvironmentFactory.class);
factories.addBinding(DockerImageEnvironment.TYPE).to(DockerImageEnvironmentFactory.class);
bind(RuntimeInfrastructure.class).to(OpenShiftInfrastructure.class);
install(new FactoryModuleBuilder().build(OpenShiftRuntimeContextFactory.class));
install(new FactoryModuleBuilder().build(OpenShiftRuntimeFactory.class));
install(new FactoryModuleBuilder().build(OpenShiftBootstrapperFactory.class));
bind(WorkspacePVCCleaner.class).asEagerSingleton();
bind(RemoveProjectOnWorkspaceRemove.class).asEagerSingleton();
bind(CheApiEnvVarProvider.class).to(OpenShiftCheApiEnvVarProvider.class);
MapBinder<String, WorkspaceVolumesStrategy> volumesStrategies =
MapBinder.newMapBinder(binder(), String.class, WorkspaceVolumesStrategy.class);
volumesStrategies.addBinding(COMMON_STRATEGY).to(CommonPVCStrategy.class);
volumesStrategies.addBinding(UNIQUE_STRATEGY).to(UniqueWorkspacePVCStrategy.class);
bind(WorkspaceVolumesStrategy.class).toProvider(WorkspaceVolumeStrategyProvider.class);
}
示例11: configure
import com.google.inject.multibindings.MapBinder; //导入方法依赖的package包/类
@Override
protected void configure() {
MapBinder<Class<?>, ArgumentParser<?>> parsers = MapBinder
.newMapBinder(binder(), new TypeLiteral<Class<?>>() {}, new TypeLiteral<ArgumentParser<?>>() {}, Names
.named("parsers"));
bind(new TypeLiteral<ArgumentParser<City>>() {}).to(CityParser.class);
parsers.addBinding(City.class).to(CityParser.class);
Multibinder<Class> cmds = newSetBinder(
binder(),
new TypeLiteral<Class>() {},
named("custom-commands")
);
for (Class command : commands) {
cmds.addBinding().toInstance(command);
}
}
示例12: testBasicMapDependencyInjection
import com.google.inject.multibindings.MapBinder; //导入方法依赖的package包/类
/** Ensure there are no initialization race conditions in basic map injection. */
public void testBasicMapDependencyInjection() {
final AtomicReference<Map<String, String>> injectedMap =
new AtomicReference<Map<String, String>>();
final Object anObject =
new Object() {
@Inject
void initialize(Map<String, String> map) {
injectedMap.set(map);
}
};
Module abc =
new AbstractModule() {
@Override
protected void configure() {
requestInjection(anObject);
MapBinder<String, String> multibinder =
MapBinder.newMapBinder(binder(), String.class, String.class);
multibinder.addBinding("a").toInstance("A");
multibinder.addBinding("b").toInstance("B");
multibinder.addBinding("c").toInstance("C");
}
};
Guice.createInjector(abc);
assertEquals(mapOf("a", "A", "b", "B", "c", "C"), injectedMap.get());
}
示例13: configure
import com.google.inject.multibindings.MapBinder; //导入方法依赖的package包/类
@Override protected void configure() {
super.configure();
parserBinder = MapBinder.newMapBinder(binder(), new TypeLiteral<String>() {},
new TypeLiteral<IParser<ISpoofaxInputUnit, ISpoofaxParseUnit>>() {});
spoofaxParserBinder = MapBinder.newMapBinder(binder(), String.class, ISpoofaxParser.class);
analyzerBinder = MapBinder.newMapBinder(binder(), new TypeLiteral<String>() {},
new TypeLiteral<IAnalyzer<ISpoofaxParseUnit, ISpoofaxAnalyzeUnit, ISpoofaxAnalyzeUnitUpdate>>() {});
spoofaxAnalyzerBinder = MapBinder.newMapBinder(binder(), String.class, ISpoofaxAnalyzer.class);
Multibinder.newSetBinder(binder(), ClassLoader.class).permitDuplicates();
bindUnit();
bindSyntax();
bindParsers(parserBinder, spoofaxParserBinder);
bindAnalyzers(analyzerBinder, spoofaxAnalyzerBinder);
bindCompletion();
bindAction();
bindTransformer();
bindCategorizer();
bindStyler();
bindTracing();
bindOutline();
bindMenu();
}
示例14: configureServlets
import com.google.inject.multibindings.MapBinder; //导入方法依赖的package包/类
@Override
protected void configureServlets()
{
// bind the properties
Names.bindProperties(binder(), this.configProperties);
// setup services
bind(SessionService.class).to(SessionServiceImpl.class);
bind(ScriptService.class).to(ScriptServiceImpl.class);
bind(RouteService.class).to(RouteServiceImpl.class);
// response processors
MapBinder<String, ResponseProcessor> responseProcessorMap = MapBinder.newMapBinder(binder(), String.class, ResponseProcessor.class);
responseProcessorMap.addBinding(ShowPageRunResult.class.getSimpleName()).to(ShowPageProcessor.class);
responseProcessorMap.addBinding(ReturnContentRunResult.class.getSimpleName()).to(ReturnContentProcessor.class);
responseProcessorMap.addBinding(RedirectRunResult.class.getSimpleName()).to(RedirectProcessor.class);
// filter
filter("/*").through(HulaWebFilter.class);
// servlet
serve("/exec*").with(HulaWebServlet.class);
}
示例15: configure
import com.google.inject.multibindings.MapBinder; //导入方法依赖的package包/类
@Override
protected void configure() {
install(new HttpMessagingModule());
bind(MessageListeners.class).to(MessageListenersImpl.class).asEagerSingleton();
bind(ServletMessageReceiver.class).to(ServletMessageReceiverImpl.class);
bind(MessageReceiver.class).to(ServletMessageReceiverImpl.class);
MapBinder<Class<? extends Address>, IMessagingSkeleton> messagingSkeletonFactory;
messagingSkeletonFactory = MapBinder.newMapBinder(binder(), new TypeLiteral<Class<? extends Address>>() {
}, new TypeLiteral<IMessagingSkeleton>() {
}, Names.named(MessagingSkeletonFactory.MIDDLEWARE_MESSAGING_SKELETONS));
messagingSkeletonFactory.addBinding(ChannelAddress.class).to(ChannelMessagingSkeleton.class);
Multibinder<GlobalAddressFactory<? extends Address>> globalAddresses;
globalAddresses = Multibinder.newSetBinder(binder(),
new TypeLiteral<GlobalAddressFactory<? extends Address>>() {
},
Names.named(GlobalAddressProvider.GLOBAL_ADDRESS_PROVIDER));
globalAddresses.addBinding().to(ServletHttpGlobalAddressFactory.class);
Multibinder<GlobalAddressFactory<? extends Address>> replyToAddresses;
replyToAddresses = Multibinder.newSetBinder(binder(),
new TypeLiteral<GlobalAddressFactory<? extends Address>>() {
},
Names.named(ReplyToAddressProvider.REPLY_TO_ADDRESS_PROVIDER));
replyToAddresses.addBinding().to(ServletHttpGlobalAddressFactory.class);
}