Java 类com.google.inject.multibindings.Multibinder 实例源码

项目:beadledom    文件:FauxModule.java   
@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();
}
项目:beadledom    文件:SwaggerModule.java   
@Override
protected void configure() {
  requireBinding(SwaggerConfig.class);

  // Create empty multibinder in case no ModelConverter bindings exist
  Multibinder<ModelConverter> swaggerModelConverterBinder = Multibinder.newSetBinder(
      binder(), ModelConverter.class);

  bind(SwaggerApiResource.class);
  bind(SwaggerUiResource.class);

  bind(ApiDeclarationProvider.class);
  bind(ResourceListingProvider.class);

  bind(JaxrsApiReader.class).to(DefaultJaxrsApiReader.class);
  bind(JaxrsScanner.class).to(SwaggerGuiceJaxrsScanner.class);

  bind(SwaggerLifecycleHook.class).asEagerSingleton();

  install(MultibindingsScanner.asModule());
}
项目:beadledom    文件:AnnotatedJacksonModule.java   
@Override
protected void configure() {
  Multibinder.newSetBinder(binder(), Module.class, clientBindingAnnotation);
  Multibinder.newSetBinder(binder(), SerializationFeatureFlag.class, clientBindingAnnotation);
  Multibinder.newSetBinder(binder(), DeserializationFeatureFlag.class, clientBindingAnnotation);
  Multibinder.newSetBinder(binder(), JsonGeneratorFeatureFlag.class, clientBindingAnnotation);
  Multibinder.newSetBinder(binder(), JsonParserFeatureFlag.class, clientBindingAnnotation);
  Multibinder.newSetBinder(binder(), MapperFeatureFlag.class, clientBindingAnnotation);

  /**
   * MultibindingsScanner will scan all modules for methods with the annotations @ProvidesIntoMap,
   * @ProvidesIntoSet, and @ProvidesIntoOptional.
   */
  install(MultibindingsScanner.asModule());
  install(AnnotatedJacksonPrivateModule.with(clientBindingAnnotation));
}
项目:beadledom    文件:HealthModule.java   
@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());
}
项目:beadledom    文件:JacksonModule.java   
@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();
}
项目:server-vot    文件:ConfigModule.java   
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);
}
项目:clustercode    文件:ConstraintModule.java   
@Override
protected void configure() {
    Multibinder<Constraint> constraintBinder = Multibinder.newSetBinder(binder(), Constraint.class);
    String none = "NONE";
    String constraints = getEnvironmentVariableOrPropertyIgnoreError(properties, CONSTRAINT_STRATEGIES_KEY, none);
    if ("ALL".equalsIgnoreCase(constraints.trim())) {
        ModuleHelper.bindAll(constraintBinder, Constraints::values);
    } else if (none.equalsIgnoreCase(constraints.trim())) {
        ModuleHelper.bindStrategies(constraintBinder, none, Constraints::valueOf);
    } else {
        try {
            ModuleHelper.bindStrategies(constraintBinder, constraints.replace(none, ""), Constraints::valueOf);
        } catch (IllegalArgumentException ex) {
            addError(ex);
        }
    }
}
项目:clustercode    文件:CleanupModule.java   
@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());

}
项目:bot4j    文件:TelegramModule.java   
@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);
}
项目:bot4j    文件:SlackModule.java   
@Override
protected void configure() {
    bind(SlackActionWebhook.class).to(SlackActionWebhookImpl.class);
    bind(SlackConfig.class).to(SlackConfigImpl.class);
    bind(SlackConfigService.class).to(SlackConfigServiceImpl.class);
    bind(SlackEventWebhook.class).to(SlackEventWebhookImpl.class);
    bind(SlackMessageSender.class).to(SlackMessageSenderImpl.class);
    bind(SlackOAuthClient.class).to(SlackOAuthClientImpl.class);
    bind(SlackOAuthWebhook.class).to(SlackOAuthWebhookImpl.class);
    bind(SlackReceiveHandler.class).to(SlackReceiveHandlerImpl.class);
    bind(SlackReceiveActionMessageFactory.class).to(SlackReceiveActionMessageFactoryImpl.class);
    bind(SlackReceiveEventMessageFactory.class).to(SlackReceiveEventMessageFactoryImpl.class);
    bind(SlackReceivePayloadFactory.class).to(SlackReceivePayloadFactoryImpl.class);
    bind(SlackSendActionFactory.class).to(SlackSendActionFactoryImpl.class);
    bind(SlackSendAttachmentFactory.class).to(SlackSendAttachmentFactoryImpl.class);

    final Multibinder<SlackSendRule> slackSendRuleBinder = Multibinder.newSetBinder(binder(), SlackSendRule.class);
    slackSendRuleBinder.addBinding().to(NativeRuleImpl.class);
    slackSendRuleBinder.addBinding().to(TextRuleImpl.class);
    slackSendRuleBinder.addBinding().to(ButtonsRuleImpl.class);
    slackSendRuleBinder.addBinding().to(ImageRuleImpl.class);
    slackSendRuleBinder.addBinding().to(VideoRuleImpl.class);
    slackSendRuleBinder.addBinding().to(BubbleRuleImpl.class);
    slackSendRuleBinder.addBinding().to(ListRuleImpl.class);
}
项目:bot4j    文件:FacebookModule.java   
@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);
}
项目:ice    文件:FileDynamicConfigSource.java   
public static Module module(final int configSourcePriority)
{
    return new AbstractModule()
    {
        @Override
        protected void configure()
        {
            MapBinder<Integer, DynamicConfigSource> mapBinder = MapBinder.newMapBinder(binder(), Integer.class, DynamicConfigSource.class);
            mapBinder.addBinding(configSourcePriority).to(FileDynamicConfigSource.class);
            bind(FileDynamicConfigSource.class);

            // Bind inner class as a service to ensure resource cleanup
            Multibinder.newSetBinder(binder(), Service.class).addBinding().to(FileDynamicConfigSourceService.class);
        }
    };
}
项目:Mastering-Mesos    文件:ClusterSimulatorModule.java   
@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);
}
项目:bobcat    文件:ReporterModule.java   
@Override
protected void configure() {
  bind(ReportEntryLogger.class).to(ReportEntryLoggerImpl.class);
  bind(TestEventCollector.class).to(TestEventCollectorImpl.class);
  bind(ReportingHandler.ACTIVE_REPORTERS).toProvider(ReporterProvider.class).in(Singleton.class);

  SubreportInterceptor subreportInterceptor = new SubreportInterceptor();
  requestInjection(subreportInterceptor);
  bindInterceptor(Matchers.any(), Matchers.annotatedWith(Subreport.class), subreportInterceptor);

  Multibinder<WebDriverEventListener> webDriverListenerBinder = Multibinder.newSetBinder(binder(),
      WebDriverEventListener.class);
  webDriverListenerBinder.addBinding().to(WebDriverLogger.class);

  Multibinder<ProxyEventListener> proxyListenerBinder = Multibinder.newSetBinder(binder(),
      ProxyEventListener.class);
  proxyListenerBinder.addBinding().to(ProxyLogger.class);

}
项目:bobcat    文件:PageObjectsModule.java   
@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);
}
项目:bobcat    文件:FieldsModule.java   
@Override
protected void configure() {
  Multibinder<DialogField> fieldsBinder = Multibinder.newSetBinder(binder(), DialogField.class);
  fieldsBinder.addBinding().to(Checkbox.class);
  fieldsBinder.addBinding().to(Textfield.class);
  fieldsBinder.addBinding().to(Image.class);
  fieldsBinder.addBinding().to(PathBrowser.class);
  fieldsBinder.addBinding().to(Select.class);
  fieldsBinder.addBinding().to(RichText.class);
  fieldsBinder.addBinding().to(Variant.class);
  fieldsBinder.addBinding().to(Multifield.class);
  fieldsBinder.addBinding().to(MultifieldItem.class);
  fieldsBinder.addBinding().to(FontFormat.class);
  fieldsBinder.addBinding().to(JustifyDialogPanel.class);
  fieldsBinder.addBinding().to(ListDialogPanel.class);
}
项目:walkaround    文件:ConvStoreModule.java   
@Override protected void configure() {
  StoreModuleHelper.makeBasicBindingsAndExposures(binder(), ConvStore.class);
  StoreModuleHelper.bindEntityKinds(binder(), ROOT_ENTITY_KIND);

  bind(SlobModel.class).to(WaveObjectStoreModel.class);
  bind(AccessChecker.class).to(ConvAccessChecker.class);
  bind(PermissionSource.class).to(ConvPermissionSource.class);

  Multibinder<PreCommitAction> preCommitActions =
      Multibinder.newSetBinder(binder(), PreCommitAction.class);
  preCommitActions.addBinding().to(IndexTask.ConvPreCommit.class);

  Multibinder<PostCommitAction> postCommitActions =
      Multibinder.newSetBinder(binder(), PostCommitAction.class);
  postCommitActions.addBinding().to(IndexTask.Conv.class);

  bind(Queue.class).annotatedWith(PostCommitActionQueue.class).toInstance(
      QueueFactory.getQueue("post-commit-conv"));
}
项目:walkaround    文件:StoreModuleHelper.java   
public static void makeBasicBindingsAndExposures(PrivateBinder binder,
    Class<? extends Annotation> annotation) {
  binder.bind(SlobFacilities.class).to(FacilitiesImpl.class);
  binder.bind(SlobStore.class).to(SlobStoreImpl.class);
  binder.install(factoryModule(MutationLogFactory.class, MutationLog.class));

  binder.bind(MutationLogFactory.class).annotatedWith(annotation).to(MutationLogFactory.class);
  binder.bind(SlobStore.class).annotatedWith(annotation).to(SlobStore.class);
  binder.bind(LocalMutationProcessor.class).annotatedWith(annotation)
      .to(LocalMutationProcessor.class);
  binder.bind(SlobFacilities.class).annotatedWith(annotation).to(FacilitiesImpl.class);

  binder.expose(MutationLogFactory.class).annotatedWith(annotation);
  binder.expose(SlobStore.class).annotatedWith(annotation);
  binder.expose(LocalMutationProcessor.class).annotatedWith(annotation);
  binder.expose(SlobFacilities.class).annotatedWith(annotation);

  // Make sure a binding for the Set exists.
  Multibinder.newSetBinder(binder, PreCommitAction.class);
  // Make sure a binding for the Set exists.
  Multibinder.newSetBinder(binder, PostCommitAction.class);
}
项目:yql-plus    文件:CompilingTestBase.java   
@Override
protected void configure() {
    install(new EngineThreadPoolModule());
    install(new ExecutionScopeModule());
    install(new PlannerCompilerModule());
    install(new ProgramTracerModule());
    install(new SearchNamespaceModule());
    install(new SourceApiModule());
    install(new PhysicalOperatorBuiltinsModule());
    install(metricModule);
    Multibinder<SourceNamespace> sourceNamespaceMultibinder = Multibinder.newSetBinder(binder(), SourceNamespace.class);
    Multibinder<ModuleNamespace> moduleNamespaceMultibinder = Multibinder.newSetBinder(binder(), ModuleNamespace.class);
    sourceNamespaceMultibinder.addBinding().toInstance(CompilingTestBase.this);
    moduleNamespaceMultibinder.addBinding().toInstance(CompilingTestBase.this);
    bind(ViewRegistry.class).toInstance(CompilingTestBase.this);
}
项目:codenvy    文件:LdapModule.java   
@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);
}
项目:ratpack-zipkin    文件:ServerTracingModule.java   
@Override
protected void configure() {
  bind(ServerTracingHandler.class)
      .to(DefaultServerTracingHandler.class)
      .in(Singleton.class);

  bind(HttpClient.class).annotatedWith(Zipkin.class)
      .to(ZipkinHttpClientImpl.class)
      .in(Singleton.class);

  bind(ZipkinHttpClientImpl.class);

  Provider<ServerTracingHandler> serverTracingHandlerProvider =
      getProvider(ServerTracingHandler.class);

  Multibinder.newSetBinder(binder(), HandlerDecorator.class).addBinding()
      .toProvider(() -> HandlerDecorator.prepend(serverTracingHandlerProvider.get()))
      .in(Singleton.class);
}
项目:dragoman    文件:RepositoryModule.java   
@Override
protected void configure() {
  Multibinder<Repository> multibinder = Multibinder.newSetBinder(binder(), Repository.class);
  multibinder.addBinding().to(HttpRepository.class);
  multibinder.addBinding().to(DecoratingMongoRepository.class);

  bind(RepositoryRouter.class).to(RepositoryRouterImpl.class);
}
项目:dragoman    文件:RestModule.java   
@Override
protected void configure() {
  Multibinder<RestResource> multibinder = Multibinder.newSetBinder(binder(), RestResource.class);
  multibinder.addBinding().to(PingResource.class);
  multibinder.addBinding().to(MetricsResource.class);
  multibinder.addBinding().to(HealthCheckResource.class);
  multibinder.addBinding().to(DatasetResource.class);
  multibinder.addBinding().to(AuthenticationResource.class);

  bind(SubscriptionManager.class).to(VertxSubscriptionManager.class);
}
项目:beadledom    文件:AvroSwaggerGuiceModule.java   
@Override
protected void configure() {
  Multibinder<ModelConverter> swaggerModelConverterBinder = Multibinder.newSetBinder(binder(),
      ModelConverter.class);

  swaggerModelConverterBinder.addBinding().to(SwaggerAvroModelConverter.class);

  install(MultibindingsScanner.asModule());
}
项目:beadledom    文件:AvroJacksonGuiceModule.java   
@Override
protected void configure() {
  Multibinder<Module> jacksonModuleBinder = Multibinder.newSetBinder(binder(), Module.class);

  jacksonModuleBinder.addBinding().to(AvroJacksonModule.class);

  install(MultibindingsScanner.asModule());
}
项目:beadledom    文件:ConfigurationSourcesModuleBuilder.java   
/**
 * Builds the {@link ConfigurationSourcesModuleBuilder} with the list of
 * {@link ConfigurationSource}s built using the {@link ConfigurationSourcesModuleBuilder
 * #addSource(ConfigurationSource)} builder method.
 *
 * @return a Guice module that configures a Multibinder for ConfigurationSources
 */
public Module build() {
  return new AbstractModule() {
    @Override
    protected void configure() {
      Multibinder<ConfigurationSource> multiBinder =
          Multibinder.newSetBinder(binder(), ConfigurationSource.class);
      for (ConfigurationSource configurationSource : configurationSources) {
        multiBinder.addBinding().toInstance(configurationSource);
      }
    }
  };
}
项目:beadledom    文件:JacksonTestModule.java   
@Override
protected void configure() {

  Multibinder<Module> jacksonModuleBinder = Multibinder.newSetBinder(binder(), Module.class);
  jacksonModuleBinder.addBinding().to(TestModule.class);
  install(new JacksonModule());
}
项目:che-archetypes    文件:JsonExampleGuiceModule.java   
@Override
protected void configure() {
  Multibinder<ProjectTypeDef> projectTypeDefMultibinder =
      newSetBinder(binder(), ProjectTypeDef.class);
  projectTypeDefMultibinder.addBinding().to(JsonExampleProjectType.class);

  Multibinder<ProjectHandler> projectHandlerMultibinder =
      newSetBinder(binder(), ProjectHandler.class);
  projectHandlerMultibinder.addBinding().to(JsonExampleCreateProjectHandler.class);

  bind(JsonLocService.class);
  bind(JsonExampleCompletionService.class);
}
项目:projectegon    文件:ServerModule.java   
@Override
protected void configure() {
    Multibinder<ServerConfiguration> binder = Multibinder.newSetBinder(binder(), ServerConfiguration.class);
    binder.addBinding().to(InfoServerConfiguration.class);
    binder.addBinding().to(LoggingServerConfiguration.class);
    binder.addBinding().to(LoginServerConfiguration.class);
}
项目:ProjectAres    文件:SetBinder.java   
protected SetBinder(Binder binder, @Nullable Key<T> key) {
    if(key == null) {
        key = Key.get(new ResolvableType<T>(){}.in(getClass()));
    }

    this.binder = binder.skipSources(SetBinder.class);
    this.elementType = key.getTypeLiteral();
    this.collectionType = new ResolvableType<Set<T>>(){}.with(new TypeArgument<T>(this.elementType){});
    this.multibinder = Multibinder.newSetBinder(binder, key);
}
项目:ProjectAres    文件:TransformableBinder.java   
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());
}
项目:ProjectAres    文件:ModelBinder.java   
private ModelBinder(ProtectedBinder protectedBinder, TypeLiteral<M> M, TypeLiteral<P> P) {
    this.binder = Binders.wrap(protectedBinder.publicBinder());
    this.M = M;
    this.P = P;

    this.metas = Multibinder.newSetBinder(binder, ModelMeta.class);
    this.serviceBinder = OptionalBinder.newOptionalBinder(binder, ModelService(M, P));
    this.queryServiceBinder = OptionalBinder.newOptionalBinder(binder, QueryService(M));
    this.updateServiceBinder = OptionalBinder.newOptionalBinder(binder, UpdateService(P));
    this.storeBinder = OptionalBinder.newOptionalBinder(binder, ModelStore(M));

    binder.install(new OneTime());
    binder.install(new PerModel());
}
项目:clustercode    文件:ScanModule.java   
@Override
protected void configure() {
    bind(FileScanner.class).to(FileScannerImpl.class);
    bind(MediaScanSettings.class).to(MediaScanSettingsImpl.class);
    bind(MediaScanService.class).to(MediaScanServiceImpl.class);

    bind(SelectionService.class).to(SelectionServiceImpl.class);

    bind(ProfileScanService.class).to(ProfileScanServiceImpl.class);
    bind(ProfileParser.class).to(ProfileParserImpl.class);
    bind(ProfileScanSettings.class).to(ProfileScanSettingsImpl.class);

    String strategies = getEnvironmentVariableOrProperty(properties, PROFILE_STRATEGY_KEY);

    ModuleHelper.checkStrategiesForOrder(strategies, PROFILE_STRATEGY_KEY,
            ProfileMatchers.COMPANION.name(), ProfileMatchers.DEFAULT.name());
    ModuleHelper.checkStrategiesForOrder(strategies, PROFILE_STRATEGY_KEY,
            ProfileMatchers.DIRECTORY_STRUCTURE.name(), ProfileMatchers.DEFAULT.name());

    Multibinder<ProfileMatcher> matcherBinder = Multibinder.newSetBinder(binder(), ProfileMatcher.class);
    try {
        ModuleHelper.bindStrategies(matcherBinder, strategies, ProfileMatchers::valueOf);
    } catch (IllegalArgumentException ex) {
        addError(ex);
    }

    bind(ProfileMatcherStrategy.class).to(ConfigurableMatcherStrategy.class);
}
项目:clustercode    文件:ActionModule.java   
@Override
protected void configure() {
    Multibinder<Action> actionBinder = Multibinder.newSetBinder(binder(), Action.class);
    actionBinder.addBinding().to(InitializeAction.class);
    actionBinder.addBinding().to(ScanMediaAction.class);
    actionBinder.addBinding().to(SelectMediaAction.class);
    actionBinder.addBinding().to(SelectProfileAction.class);
    actionBinder.addBinding().to(AddTaskInClusterAction.class);
    actionBinder.addBinding().to(TranscodeAction.class);
    actionBinder.addBinding().to(RemoveTaskFromClusterAction.class);
    actionBinder.addBinding().to(CleanupAction.class);
    actionBinder.addBinding().to(LoggedAction.class);
}
项目:queries    文件:QueriesGuiceSupport.java   
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);
            }
        };
    }
项目:queries    文件:QueriesGuiceSupport.java   
@SafeVarargs
public static Module sourceClassesModule(Class<QueriesSource>... sources) {
    return new AbstractModule() {
        @Override
        protected void configure() {
            Multibinder<QueriesSource> sourcesBinder = Multibinder.newSetBinder(binder(), QueriesSource.class);
            for (Class<QueriesSource> source : sources) {
                sourcesBinder.addBinding().to(source);
            }
        }
    };
}
项目:queries    文件:QueriesGuiceSupport.java   
public Module build() {
    return new AbstractModule() {
        @Override
        protected void configure() {
            Multibinder<QueriesSource> sourcesBinder = Multibinder.newSetBinder(binder(), QueriesSource.class);
            for (QueriesSource source : sources) {
                sourcesBinder.addBinding().toInstance(source);
            }
        }
    };
}
项目:movie-recommender    文件:MainModule.java   
@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);
}
项目:morf    文件:MorfModule.java   
/**
 * @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);
}
项目:ice    文件:FileDynamicConfigSourceTest.java   
@Test(timeout = 5000)
public void testFile() throws Exception
{
    Injector injector = Guice.createInjector(Modules.override(
        ConfigConfigurator.standardModules())
        .with(new AbstractModule()
        {
            @Override
            protected void configure()
            {
                bind(Duration.class).annotatedWith(named(FileDynamicConfigSource.POLL_INTERVAL_NAME)).toInstance(Duration.ofMillis(250));
                bind(String.class).annotatedWith(named(FileDynamicConfigSource.FILENAME_NAME)).toInstance(getClass().getResource("test.config").getFile());

                final List<ConfigDescriptor> configDescList = descriptorFactory.buildDescriptors(Config.class, Optional.empty());
                Multibinder<ConfigDescriptor> multiBinder = Multibinder.newSetBinder(binder(), ConfigDescriptor.class);
                configDescList.stream().forEach(desc -> multiBinder.addBinding().toInstance(desc));
            }
        }));

    injector.injectMembers(this);

    assertNotNull(source);

    assertEquals(Optional.of("true"), getValueFor(Config.class.getMethod("enabled")));
    assertEquals(Optional.of("1234"), getValueFor(Config.class.getMethod("abcDef")));
    assertEquals(Optional.empty(), getValueFor(Config.class.getMethod("notInFile")));
}