本文整理匯總了Java中com.google.inject.multibindings.Multibinder.newSetBinder方法的典型用法代碼示例。如果您正苦於以下問題:Java Multibinder.newSetBinder方法的具體用法?Java Multibinder.newSetBinder怎麽用?Java Multibinder.newSetBinder使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.inject.multibindings.Multibinder
的用法示例。
在下文中一共展示了Multibinder.newSetBinder方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: configure
import com.google.inject.multibindings.Multibinder; //導入方法依賴的package包/類
@Override
protected void configure() {
bind(CleanupService.class).to(CleanupServiceImpl.class);
bind(CleanupStrategy.class).to(ConfigurableCleanupStrategy.class);
bind(CleanupSettings.class).to(CleanupSettingsImpl.class);
String strategies = getEnvironmentVariableOrProperty(properties, CLEANUP_STRATEGY_KEY).toUpperCase(Locale.ENGLISH);
Multibinder<CleanupProcessor> cleanupBinder = Multibinder.newSetBinder(binder(), CleanupProcessor.class);
try {
ModuleHelper.bindStrategies(cleanupBinder, strategies, CleanupProcessors::valueOf);
} catch (IllegalArgumentException ex) {
addError(new InvalidConfigurationException("Invalid cleanup strategy: {}.", ex.getMessage()));
}
ModuleHelper.checkStrategiesForIncompatibilities(strategies, CLEANUP_STRATEGY_KEY,
CleanupProcessors.STRUCTURED_OUTPUT.name(), CleanupProcessors.UNIFIED_OUTPUT.name());
ModuleHelper.checkStrategiesForIncompatibilities(strategies, CLEANUP_STRATEGY_KEY,
CleanupProcessors.DELETE_SOURCE.name(), CleanupProcessors.MARK_SOURCE.name());
}
示例2: configure
import com.google.inject.multibindings.Multibinder; //導入方法依賴的package包/類
@Override
protected void configure() {
install(new ResteasyModule());
bind(HelloDao.class).in(Singleton.class);
bind(HelloResource.class);
BuildInfo buildInfo = BuildInfo.load(getClass().getResourceAsStream("build-info.properties"));
bind(BuildInfo.class).toInstance(buildInfo);
bind(ServiceMetadata.class).toInstance(
ServiceMetadata.builder()
.setBuildInfo(buildInfo)
.setHostName("bogusbox")
.setStartupTime(Instant.parse("2001-01-01T01:01:01Z"))
.build()); // In a real service, use ServiceMetadata.create instead of ServiceMetadata.builder
Multibinder<HealthDependency> healthDependencyBinder =
Multibinder.newSetBinder(binder(), HealthDependency.class);
healthDependencyBinder.addBinding().to(ImportantThingHealthDependency.class);
bind(FauxLifecycleHook.class).asEagerSingleton();
}
示例3: bindRoutes
import com.google.inject.multibindings.Multibinder; //導入方法依賴的package包/類
private void bindRoutes() {
Multibinder<SparkRouter> routerBinder = Multibinder.newSetBinder(binder(), SparkRouter.class);
routerBinder.addBinding().to(SignUpRouter.class);
routerBinder.addBinding().to(LogInRouter.class);
routerBinder.addBinding().to(UserProfileRouter.class);
routerBinder.addBinding().to(ListMachinesRouter.class);
routerBinder.addBinding().to(AddMachineRouter.class);
routerBinder.addBinding().to(RemoveMachineRouter.class);
routerBinder.addBinding().to(EditMachineRouter.class);
routerBinder.addBinding().to(GetMachineRouter.class);
routerBinder.addBinding().to(EditPersonRouter.class);
routerBinder.addBinding().to(EditPasswordRouter.class);
routerBinder.addBinding().to(AddTechnicianRouter.class);
routerBinder.addBinding().to(ListTechniciansRouter.class);
routerBinder.addBinding().to(AssignMaintainerRouter.class);
routerBinder.addBinding().to(RemoveTechnicianRouter.class);
routerBinder.addBinding().to(GetPersonProfileRouter.class);
}
示例4: configure
import com.google.inject.multibindings.Multibinder; //導入方法依賴的package包/類
@Override
protected void configure() {
bind(FacebookConfig.class).to(FacebookConfigImpl.class);
bind(FacebookConfigService.class).to(FacebookConfigServiceImpl.class);
bind(FacebookMessageSender.class).to(FacebookMessageSenderImpl.class);
bind(FacebookReceiveHandler.class).to(FacebookReceiveHandlerImpl.class);
bind(FacebookReceiveMessageFactory.class).to(FacebookReceiveMessageFactoryImpl.class);
bind(FacebookReceivePayloadFactory.class).to(FacebookReceivePayloadFactoryImpl.class);
bind(FacebookSendButtonFactory.class).to(FacebookSendButtonFactoryImpl.class);
bind(FacebookWebhook.class).to(FacebookWebhookImpl.class);
final Multibinder<FacebookSendRule> facebookSendRuleBinder = Multibinder.newSetBinder(binder(),
FacebookSendRule.class);
facebookSendRuleBinder.addBinding().to(NativeRuleImpl.class);
facebookSendRuleBinder.addBinding().to(TextRuleImpl.class);
facebookSendRuleBinder.addBinding().to(ButtonsRuleImpl.class);
facebookSendRuleBinder.addBinding().to(ImageRuleImpl.class);
facebookSendRuleBinder.addBinding().to(VideoRuleImpl.class);
facebookSendRuleBinder.addBinding().to(QuickRepliesRuleImpl.class);
facebookSendRuleBinder.addBinding().to(TypingRuleImpl.class);
facebookSendRuleBinder.addBinding().to(BubbleRuleImpl.class);
facebookSendRuleBinder.addBinding().to(ListRuleImpl.class);
}
示例5: configure
import com.google.inject.multibindings.Multibinder; //導入方法依賴的package包/類
@Override
protected void configure() {
bind(TelegramWebhook.class).to(TelegramWebhookImpl.class);
bind(TelegramConfig.class).to(TelegramConfigImpl.class);
bind(TelegramConfigService.class).to(TelegramConfigServiceImpl.class);
bind(TelegramMessageSender.class).to(TelegramMessageSenderImpl.class);
bind(TelegramSendInlineKeyboardFactory.class).to(TelegramSendInlineKeyboardFactoryImpl.class);
bind(TelegramReceiveHandler.class).to(TelegramReceiveHandlerImpl.class);
bind(TelegramReceiveMessageFactory.class).to(TelegramReceiveMessageFactoryImpl.class);
bind(TelegramReceivePayloadFactory.class).to(TelegramReceivePayloadFactoryImpl.class);
bind(TelegramWebhook.class).to(TelegramWebhookImpl.class);
final Multibinder<TelegramSendRule> telegramSendRuleBinder = Multibinder.newSetBinder(binder(),
TelegramSendRule.class);
telegramSendRuleBinder.addBinding().to(BubbleRuleImpl.class);
telegramSendRuleBinder.addBinding().to(ButtonsRuleImpl.class);
telegramSendRuleBinder.addBinding().to(ImageRuleImpl.class);
telegramSendRuleBinder.addBinding().to(ListRuleImpl.class);
telegramSendRuleBinder.addBinding().to(NativeRuleImpl.class);
telegramSendRuleBinder.addBinding().to(TextRuleImpl.class);
telegramSendRuleBinder.addBinding().to(VideoRuleImpl.class);
}
示例6: configure
import com.google.inject.multibindings.Multibinder; //導入方法依賴的package包/類
@Override
protected void configure() {
requireBinding(ServiceMetadata.class);
requireBinding(UriInfo.class);
bind(AvailabilityResource.class).to(AvailabilityResourceImpl.class);
bind(HealthResource.class).to(HealthResourceImpl.class);
bind(DependenciesResource.class).to(DependenciesResourceImpl.class);
bind(DiagnosticResource.class).to(DiagnosticResourceImpl.class);
bind(VersionResource.class).to(VersionResourceImpl.class);
bind(HealthChecker.class);
//This is to provide a default binding for HealthDependency,
// so that services with no HealthDependency bindings can start
Multibinder<HealthDependency> healthDependencyModuleBinder = Multibinder.newSetBinder(binder(),
HealthDependency.class);
Multibinder<Module> jacksonModuleBinder = Multibinder.newSetBinder(binder(), Module.class);
jacksonModuleBinder.addBinding().to(Jdk8Module.class);
jacksonModuleBinder.addBinding().to(JavaTimeModule.class);
install(MultibindingsScanner.asModule());
}
示例7: configure
import com.google.inject.multibindings.Multibinder; //導入方法依賴的package包/類
@Override
protected void configure() {
// Empty multibindings for dependencies
Multibinder<Module> jacksonModuleBinder = Multibinder.newSetBinder(binder(), Module.class);
Multibinder<SerializationFeatureFlag> serializationFeatureBinder = Multibinder
.newSetBinder(binder(), SerializationFeatureFlag.class);
Multibinder<DeserializationFeatureFlag> deserializationFeatureBinder = Multibinder
.newSetBinder(binder(), DeserializationFeatureFlag.class);
Multibinder<JsonGeneratorFeatureFlag> jsonGeneratorFeatureBinder = Multibinder
.newSetBinder(binder(), JsonGeneratorFeatureFlag.class);
Multibinder<JsonParserFeatureFlag> jsonParserFeatureBinder = Multibinder
.newSetBinder(binder(), JsonParserFeatureFlag.class);
Multibinder<MapperFeatureFlag> mapperFeatureBinder = Multibinder
.newSetBinder(binder(), MapperFeatureFlag.class);
/**
* MultibindingsScanner will scan all modules for methods with the annotations @ProvidesIntoMap,
* @ProvidesIntoSet, and @ProvidesIntoOptional.
*/
install(MultibindingsScanner.asModule());
bind(ObjectMapper.class).toProvider(ObjectMapperProvider.class).asEagerSingleton();
}
示例8: configure
import com.google.inject.multibindings.Multibinder; //導入方法依賴的package包/類
@Override
protected void configure() {
Multibinder<AuthenticationHandler> handlerBinder =
Multibinder.newSetBinder(
binder(), com.codenvy.api.dao.authentication.AuthenticationHandler.class);
handlerBinder.addBinding().to(LdapAuthenticationHandler.class);
bind(Authenticator.class).toProvider(AuthenticatorProvider.class);
bind(ConnectionFactory.class).toProvider(LdapConnectionFactoryProvider.class);
bind(PooledConnectionFactory.class).toProvider(LdapConnectionFactoryProvider.class);
bind(EntryResolver.class).toProvider(EntryResolverProvider.class);
bind(DBUserLinker.class).toProvider(DBUserLinkerProvider.class);
bind(LdapEntrySelector.class).toProvider(LdapEntrySelectorProvider.class);
bind(LdapSynchronizer.class).asEagerSingleton();
bind(LdapSynchronizerService.class);
bind(LdapSynchronizerPermissionsFilter.class);
bind(DisablePasswordOperationsFilter.class);
}
示例9: configure
import com.google.inject.multibindings.Multibinder; //導入方法依賴的package包/類
@Override
protected void configure() {
bind(FakeSlaves.class).in(Singleton.class);
Multibinder<Offer> offers = Multibinder.newSetBinder(binder(), Offer.class);
offers.addBinding()
.toInstance(baseOffer("slave-1", "a", 16, 16 * 1024, 100 * 1024));
offers.addBinding()
.toInstance(baseOffer("slave-2", "a", 16, 16 * 1024, 100 * 1024));
offers.addBinding()
.toInstance(baseOffer("slave-3", "b", 16, 16 * 1024, 100 * 1024));
offers.addBinding()
.toInstance(baseOffer("slave-4", "b", 16, 16 * 1024, 100 * 1024));
offers.addBinding()
.toInstance(dedicated(baseOffer("slave-5", "c", 24, 128 * 1024, 1824 * 1024), "database"));
offers.addBinding()
.toInstance(dedicated(baseOffer("slave-6", "c", 24, 128 * 1024, 1824 * 1024), "database"));
SchedulerServicesModule.addAppStartupServiceBinding(binder()).to(Register.class);
}
示例10: configure
import com.google.inject.multibindings.Multibinder; //導入方法依賴的package包/類
@Override
protected void configure() {
bindListener(any(), new PageObjectTypeListener());
bindListener(any(), new TestObjectTypeListener());
Multibinder<FieldProvider> fieldProviders =
Multibinder.newSetBinder(binder(), FieldProvider.class);
fieldProviders.addBinding().to(ScopedPageObjectProvider.class);
fieldProviders.addBinding().to(SelectorPageObjectProvider.class);
fieldProviders.addBinding().to(PageObjectListProxyProvider.class);
fieldProviders.addBinding().to(CurrentFrameProvider.class);
fieldProviders.addBinding().to(PageObjectSelectorListProxyProvider.class);
bind(Key.get(WebElement.class, CurrentScope.class)).toProvider(CurrentWebElementProvider.class);
bind(new TypeLiteral<List<WebElement>>() {
}).annotatedWith(CurrentScope.class).toProvider(CurrentScopeListProvider.class);
}
示例11: configure
import com.google.inject.multibindings.Multibinder; //導入方法依賴的package包/類
/**
* @see com.google.inject.AbstractModule#configure()
*/
@Override
protected void configure() {
Multibinder.newSetBinder(binder(), UpgradeScriptAddition.class);
Multibinder<TableContribution> tableMultibinder = Multibinder.newSetBinder(binder(), TableContribution.class);
tableMultibinder.addBinding().to(DatabaseUpgradeTableContribution.class);
}
示例12: proxyModule
import com.google.inject.multibindings.Multibinder; //導入方法依賴的package包/類
public static <T> Module proxyModule(Class<T> proxyInterface) {
return new AbstractModule() {
@Override
protected void configure() {
Provider<Queries> provider = getProvider(Queries.class);
Multibinder<QueriesSource> sourcesBinder = Multibinder.newSetBinder(binder(), QueriesSource.class);
sourcesBinder.addBinding().toInstance(QueriesSource.ofClass(proxyInterface));
bind(proxyInterface).toProvider(new ProxyInterfaceProvider<T>(provider, proxyInterface))
.in(Singleton.class);
}
};
}
示例13: configure
import com.google.inject.multibindings.Multibinder; //導入方法依賴的package包/類
@Override
protected void configure() {
Multibinder<Job> uriBinder = Multibinder.newSetBinder(binder(), Job.class);
uriBinder.addBinding().to(StreamingJob.class);
uriBinder.addBinding().to(ImportRatingsJob.class);
uriBinder.addBinding().to(ModelFinderJob.class);
uriBinder.addBinding().to(TrainJob.class);
uriBinder.addBinding().to(SaveUserRecommendationsJob.class);
uriBinder.addBinding().to(UserCountJob.class);
}
示例14: configure
import com.google.inject.multibindings.Multibinder; //導入方法依賴的package包/類
@Override
protected void configure() {
Multibinder<Module> jacksonModuleBinder = Multibinder.newSetBinder(binder(), Module.class);
jacksonModuleBinder.addBinding().to(AvroJacksonModule.class);
install(MultibindingsScanner.asModule());
}
示例15: TransformableBinder
import com.google.inject.multibindings.Multibinder; //導入方法依賴的package包/類
public TransformableBinder(Binder binder, @Nullable Key<T> keyOrNull) {
this.binder = binder.skipSources(TransformableBinder.class, TransformingProvider.class);
this.key = keyOrNull != null ? keyOrNull : Key.get(new ResolvableType<T>(){}.in(getClass()));
this.untransformedKey = Keys.get(key, new UntransformedImpl());
final TypeLiteral<Transformer<T>> transformerType = new ResolvableType<Transformer<T>>(){}.with(new TypeArgument<T>(key.getTypeLiteral()){});
final Annotation annotation = key.getAnnotation();
this.transformerSetKey = Keys.get(Types.setOf(transformerType), annotation);
this.transformerBinder = Multibinder.newSetBinder(this.binder, Keys.get(transformerType, annotation));
this.binder.install(new TransformingProvider());
}