Java 类com.google.inject.assistedinject.FactoryModuleBuilder 实例源码

项目:songs_play    文件:MyModule.java   
@Override
protected void configure() {
    install(new FactoryModuleBuilder().implement(IMailer.class, Mailer.class).build(MailerFactory.class));

    bind(Resolver.class).to(MyResolver.class);

    bind(DataInitializer.class).asEagerSingleton();

    bind(MyUserService.class).asEagerSingleton();
    //bind(GoogleAuthProvider.class).asEagerSingleton();
    //bind(FacebookAuthProvider.class).asEagerSingleton();
    //bind(FoursquareAuthProvider.class).asEagerSingleton();
    bind(MyUsernamePasswordAuthProvider.class).asEagerSingleton();
    bind(OpenIdAuthProvider.class).asEagerSingleton();
    //bind(TwitterAuthProvider.class).asEagerSingleton();
    //bind(LinkedinAuthProvider.class).asEagerSingleton();
    //bind(VkAuthProvider.class).asEagerSingleton();
    //bind(XingAuthProvider.class).asEagerSingleton();
    //bind(UntappdAuthProvider.class).asEagerSingleton();
    //bind(PocketAuthProvider.class).asEagerSingleton();
    //bind(GithubAuthProvider.class).asEagerSingleton();
    bind(MyStupidBasicAuthProvider.class).asEagerSingleton();
    //bind(SpnegoAuthProvider.class).asEagerSingleton();
    //bind(EventBriteAuthProvider.class).asEagerSingleton();
}
项目:google-gin    文件:GinjectorGeneratorModule.java   
@Override
protected void configure() {
  install(new ResolutionModule());
  install(new OutputModule());

  bind(TreeLogger.class).toInstance(logger);
  bind(GeneratorContext.class).toInstance(ctx);
  bind(new TypeLiteral<Class<? extends Ginjector>>(){})
      .annotatedWith(GinjectorInterfaceType.class)
      .toInstance(ginjectorInterface);
  bind(GinjectorBindings.class).annotatedWith(RootBindings.class)
      .to(GinjectorBindings.class).in(Singleton.class);
  bind(BindingIndex.class)
      .to(Key.get(GinjectorBindings.class, RootBindings.class))
      .in(Singleton.class);
  install(new FactoryModuleBuilder()
      .build(GuiceElementVisitor.GuiceElementVisitorFactory.class));
  bind(new TypeLiteral<Set<Class<? extends GinModule>>>(){})
      .annotatedWith(ModuleClasses.class)
      .toInstance(moduleClasses);
  bind(BindingFactory.class).to(BindingFactoryImpl.class);
  install(new FactoryModuleBuilder()
      .build(SourceWriteUtil.Factory.class));
}
项目:Re-Collector    文件:CollectorModule.java   
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);
}
项目:Re-Collector    文件:CollectorModule.java   
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);
}
项目:empiria.player    文件:VariableProcessorFunctionalTestBase.java   
@Before
public void setUp() {
    this.injector = Guice.createInjector(new AbstractModule() {
        @Override
        protected void configure() {
            bind(ModulesVariablesProcessor.class).annotatedWith(PageScoped.class).to(ModulesVariablesProcessor.class).in(Singleton.class);
            bind(AnswerEvaluationSupplier.class).annotatedWith(PageScoped.class).to(AnswerEvaluationSupplier.class).in(Singleton.class);
            bind(GroupedAnswersManager.class).annotatedWith(PageScoped.class).to(GroupedAnswersManager.class).in(Singleton.class);
            bind(ModulesProcessingResults.class).annotatedWith(PageScoped.class).to(ModulesProcessingResults.class).in(Singleton.class);
            bind(StyleSocket.class).toInstance(mock(StyleSocket.class));
            install(new FactoryModuleBuilder().build(ProcessingResultsToOutcomeMapConverterFactory.class));
        }
    });

    defaultVariableProcessor = injector.getInstance(VariablesProcessingInitializingWrapper.class);

    answerEvaluationProvider = injector.getInstance(Key.get(AnswerEvaluationSupplier.class, PageScoped.class));

    processingMode = ProcessingMode.USER_INTERACT;
}
项目:tac-kbp-eal    文件:ScoreKBPAgainstERE.java   
@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));
}
项目:standalone-app    文件:JavaFXApplication.java   
@Override
public void init(List<Module> list) throws Exception {
    list.add(
            new AbstractModule() {
                @Override
                protected void configure() {
                    bind(Stage.class).annotatedWith(Names.named("mainStage")).toProvider(PRIMARY_STAGE::get);
                    bind(EditorController.class);
                }
            }
    );
    list.add(new FactoryModuleBuilder()
            .implement(DisassemblerView.class, DisassemblerView.class)
            .build(DisassemblerViewFactory.class)
    );
}
项目:graylog-plugin-pipeline-processor    文件:PipelineProcessorModule.java   
@Override
protected void configure() {
    addPeriodical(LegacyDefaultStreamMigration.class);

    addMessageProcessor(PipelineInterpreter.class, PipelineInterpreter.Descriptor.class);
    addRestResource(RuleResource.class);
    addRestResource(PipelineResource.class);
    addRestResource(PipelineConnectionsResource.class);
    addRestResource(SimulatorResource.class);
    addPermissions(PipelineRestPermissions.class);

    install(new ProcessorFunctionsModule());

    installSearchResponseDecorator(searchResponseDecoratorBinder(),
            PipelineProcessorMessageDecorator.class,
            PipelineProcessorMessageDecorator.Factory.class);

    install(new FactoryModuleBuilder().build(PipelineInterpreter.State.Factory.class));

    addAuditEventTypes(PipelineProcessorAuditEventTypes.class);

    addConfigBeans();
}
项目:robobee-osgi    文件:CmdModule.java   
@Override
protected void configure() {
    install(new FactoryModuleBuilder().implement(CmdRun.class, CmdRun.class)
            .build(CmdRunFactory.class));
    install(new FactoryModuleBuilder()
            .implement(SshMaster.class, SshMaster.class)
            .build(SshMasterFactory.class));
    install(new FactoryModuleBuilder()
            .implement(CmdArgs.class, CmdArgs.class)
            .build(CmdArgsFactory.class));
    install(new FactoryModuleBuilder()
            .implement(SshOptions.class, SshOptions.class)
            .build(SshOptionsFactory.class));
    install(new FactoryModuleBuilder()
            .implement(ArgsMap.class, ArgsMap.class)
            .build(ArgsMapFactory.class));
}
项目:guacamole-client    文件:SharingProfileModule.java   
@Override
protected void configure() {

    // Create the required DirectoryResourceFactory implementation
    install(new FactoryModuleBuilder()
            .implement(
                new TypeLiteral<DirectoryResource<SharingProfile, APISharingProfile>>() {},
                SharingProfileDirectoryResource.class
            )
            .build(new TypeLiteral<DirectoryResourceFactory<SharingProfile, APISharingProfile>>() {}));

    // Create the required DirectoryObjectResourceFactory implementation
    install(new FactoryModuleBuilder()
            .implement(
                new TypeLiteral<DirectoryObjectResource<SharingProfile, APISharingProfile>>() {},
                SharingProfileResource.class
            )
            .build(new TypeLiteral<DirectoryObjectResourceFactory<SharingProfile, APISharingProfile>>() {}));

    // Bind translator for converting between SharingProfile and APISharingProfile
    bind(new TypeLiteral<DirectoryObjectTranslator<SharingProfile, APISharingProfile>>() {})
            .to(SharingProfileObjectTranslator.class);

}
项目:guacamole-client    文件:UserModule.java   
@Override
protected void configure() {

    // Create the required DirectoryResourceFactory implementation
    install(new FactoryModuleBuilder()
            .implement(
                new TypeLiteral<DirectoryResource<User, APIUser>>() {},
                UserDirectoryResource.class
            )
            .build(new TypeLiteral<DirectoryResourceFactory<User, APIUser>>() {}));

    // Create the required DirectoryObjectResourceFactory implementation
    install(new FactoryModuleBuilder()
            .implement(
                new TypeLiteral<DirectoryObjectResource<User, APIUser>>() {},
                UserResource.class
            )
            .build(new TypeLiteral<DirectoryObjectResourceFactory<User, APIUser>>() {}));

    // Bind translator for converting between User and APIUser
    bind(new TypeLiteral<DirectoryObjectTranslator<User, APIUser>>() {})
            .to(UserObjectTranslator.class);

}
项目:guacamole-client    文件:ConnectionModule.java   
@Override
protected void configure() {

    // Create the required DirectoryResourceFactory implementation
    install(new FactoryModuleBuilder()
            .implement(
                new TypeLiteral<DirectoryResource<Connection, APIConnection>>() {},
                ConnectionDirectoryResource.class
            )
            .build(new TypeLiteral<DirectoryResourceFactory<Connection, APIConnection>>() {}));

    // Create the required DirectoryObjectResourceFactory implementation
    install(new FactoryModuleBuilder()
            .implement(
                new TypeLiteral<DirectoryObjectResource<Connection, APIConnection>>() {},
                ConnectionResource.class
            )
            .build(new TypeLiteral<DirectoryObjectResourceFactory<Connection, APIConnection>>() {}));

    // Bind translator for converting between Connection and APIConnection
    bind(new TypeLiteral<DirectoryObjectTranslator<Connection, APIConnection>>() {})
            .to(ConnectionObjectTranslator.class);

}
项目:guacamole-client    文件:ConnectionGroupModule.java   
@Override
protected void configure() {

    // Create the required DirectoryResourceFactory implementation
    install(new FactoryModuleBuilder()
            .implement(
                new TypeLiteral<DirectoryResource<ConnectionGroup, APIConnectionGroup>>() {},
                ConnectionGroupDirectoryResource.class
            )
            .build(new TypeLiteral<DirectoryResourceFactory<ConnectionGroup, APIConnectionGroup>>() {}));

    // Create the required DirectoryObjectResourceFactory implementation
    install(new FactoryModuleBuilder()
            .implement(
                new TypeLiteral<DirectoryObjectResource<ConnectionGroup, APIConnectionGroup>>() {},
                ConnectionGroupResource.class
            )
            .build(new TypeLiteral<DirectoryObjectResourceFactory<ConnectionGroup, APIConnectionGroup>>() {}));

    // Bind translator for converting between ConnectionGroup and APIConnectionGroup
    bind(new TypeLiteral<DirectoryObjectTranslator<ConnectionGroup, APIConnectionGroup>>() {})
            .to(ConnectionGroupObjectTranslator.class);

}
项目:guacamole-client    文件:ActiveConnectionModule.java   
@Override
protected void configure() {

    // Create the required DirectoryResourceFactory implementation
    install(new FactoryModuleBuilder()
            .implement(
                new TypeLiteral<DirectoryResource<ActiveConnection, APIActiveConnection>>() {},
                ActiveConnectionDirectoryResource.class
            )
            .build(new TypeLiteral<DirectoryResourceFactory<ActiveConnection, APIActiveConnection>>() {}));

    // Create the required DirectoryObjectResourceFactory implementation
    install(new FactoryModuleBuilder()
            .implement(
                new TypeLiteral<DirectoryObjectResource<ActiveConnection, APIActiveConnection>>() {},
                ActiveConnectionResource.class
            )
            .build(new TypeLiteral<DirectoryObjectResourceFactory<ActiveConnection, APIActiveConnection>>() {}));

    // Bind translator for converting between ActiveConnection and APIActiveConnection
    bind(new TypeLiteral<DirectoryObjectTranslator<ActiveConnection, APIActiveConnection>>() {})
            .to(ActiveConnectionObjectTranslator.class);

}
项目:Wiab.pro    文件:PersistenceModule.java   
private void bindDeltaStore() {
  switch (deltaStoreType.toLowerCase()) {
    case CoreSettings.STORE_TYPE_MEMORY:
      bind(DeltaStore.class).to(MemoryDeltaStore.class).in(Singleton.class);
      bind(SnapshotStore.class).to(MemorySnapshotStore.class).in(Singleton.class);
      break;

    case CoreSettings.STORE_TYPE_FILE:
      bind(DeltaStore.class).to(FileDeltaStore.class).in(Singleton.class);
      bind(SnapshotStore.class).to(FileSnapshotStore.class).in(Singleton.class);
      break;

    default:
      throw new RuntimeException("Invalid delta store type: '" + deltaStoreType + "'");
  }
  bind(DeltaWaveletStateMap.class).in(Singleton.class);
  install(new FactoryModuleBuilder().implement(DeltaWaveletState.class, DeltaWaveletStateImpl.class).build(
    DeltaWaveletState.GuiceFactory.class));
}
项目:KeepTry    文件:SocketTest.java   
@Before
public void setupInjection() {
    Guice.createInjector(
            new AbstractModule() {
                @Override
                protected void configure() {
                    install(new FactoryModuleBuilder().build(MySshServerFactory.class));
                }

                @Provides
                @Singleton
                @SshListenAddresses
                public List<SocketAddress> getListenAddresses() {
                    return Arrays.<SocketAddress>asList(new InetSocketAddress(29488));
                }
            }

    ).injectMembers(this);
}
项目:incubator-tephra    文件:TransactionLocalModule.java   
@Override
protected void configure() {
  bind(SnapshotCodecProvider.class).in(Singleton.class);
  bind(TransactionStateStorage.class).annotatedWith(Names.named("persist"))
    .to(LocalFileTransactionStateStorage.class).in(Scopes.SINGLETON);
  bind(TransactionStateStorage.class).toProvider(TransactionStateStorageProvider.class).in(Scopes.SINGLETON);

  bind(TransactionManager.class).in(Scopes.SINGLETON);
  bind(TransactionSystemClient.class).to(InMemoryTxSystemClient.class).in(Singleton.class);
  bind(MetricsCollector.class).to(DefaultMetricsCollector.class);

  bindConstant().annotatedWith(Names.named(TxConstants.CLIENT_ID)).to(clientId);

  install(new FactoryModuleBuilder()
            .implement(TransactionExecutor.class, DefaultTransactionExecutor.class)
            .build(TransactionExecutorFactory.class));
}
项目:incubator-tephra    文件:TransactionDistributedModule.java   
@Override
protected void configure() {
  // some of these classes need to be non-singleton in order to create a new instance during leader() in
  // TransactionService
  bind(SnapshotCodecProvider.class).in(Singleton.class);
  bind(TransactionStateStorage.class).annotatedWith(Names.named("persist")).to(HDFSTransactionStateStorage.class);
  bind(TransactionStateStorage.class).toProvider(TransactionStateStorageProvider.class);

  bindConstant().annotatedWith(Names.named(TxConstants.CLIENT_ID)).to(clientId);

  // to catch issues during configure time
  bind(TransactionManager.class);
  bind(TransactionSystemClient.class).to(TransactionServiceClient.class).in(Scopes.SINGLETON);
  bind(MetricsCollector.class).to(DefaultMetricsCollector.class);

  install(new FactoryModuleBuilder()
      .implement(TransactionExecutor.class, DefaultTransactionExecutor.class)
      .build(TransactionExecutorFactory.class));
}
项目:collector    文件:CollectorModule.java   
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);
}
项目:collector    文件:CollectorModule.java   
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);
}
项目:standalone-app    文件:JavaFXApplication.java   
@Override
public void init(List<Module> list) throws Exception {
    list.add(
            new AbstractModule() {
                @Override
                protected void configure() {
                    bind(Stage.class).annotatedWith(Names.named("mainStage")).toProvider(PRIMARY_STAGE::get);
                    bind(EditorController.class);
                }
            }
    );
    list.add(new FactoryModuleBuilder()
            .implement(DisassemblerView.class, DisassemblerView.class)
            .build(DisassemblerViewFactory.class)
    );
}
项目:protostuff-compiler    文件:ParserModule.java   
@Override
protected void configure() {
    bind(Importer.class).to(ImporterImpl.class);
    bind(FileDescriptorLoader.class).to(FileDescriptorLoaderImpl.class);
    bind(ANTLRErrorListener.class).to(ParseErrorLogger.class);
    bind(ANTLRErrorStrategy.class).to(BailErrorStrategy.class);
    bind(ProtoContext.class)
            .annotatedWith(Names.named(DESCRIPTOR_PROTO))
            .toProvider(DefaultDescriptorProtoProvider.class);

    Multibinder<ProtoContextPostProcessor> postProcessors = Multibinder
            .newSetBinder(binder(), ProtoContextPostProcessor.class);
    postProcessors.addBinding().to(ImportsPostProcessor.class);
    postProcessors.addBinding().to(TypeRegistratorPostProcessor.class);
    postProcessors.addBinding().to(TypeResolverPostProcessor.class);
    postProcessors.addBinding().to(ExtensionRegistratorPostProcessor.class);
    postProcessors.addBinding().to(OptionsPostProcessor.class);
    postProcessors.addBinding().to(UserTypeValidationPostProcessor.class);

    install(new FactoryModuleBuilder()
            .implement(FileReader.class, MultiPathFileReader.class)
            .build(FileReaderFactory.class));
}
项目:protostuff-compiler    文件:CompilerModule.java   
@Override
protected void configure() {
    bind(CompilerRegistry.class);
    bind(CompilerUtils.class);
    bind(MarkdownProcessor.class).to(PegDownMarkdownProcessor.class).in(Scopes.SINGLETON);
    install(new FactoryModuleBuilder()
            .implement(ProtoCompiler.class, StCompiler.class)
            .build(StCompilerFactory.class));
    install(new FactoryModuleBuilder()
            .implement(ProtoCompiler.class, ExtensibleStCompiler.class)
            .build(ExtensibleStCompilerFactory.class));
    Multibinder<HtmlCompiler> htmlCompilerBinder = Multibinder.newSetBinder(binder(), HtmlCompiler.class);
    htmlCompilerBinder.addBinding().to(JsonIndexGenerator.class);
    htmlCompilerBinder.addBinding().to(JsonEnumGenerator.class);
    htmlCompilerBinder.addBinding().to(JsonMessageGenerator.class);
    htmlCompilerBinder.addBinding().to(JsonServiceGenerator.class);
    htmlCompilerBinder.addBinding().to(JsonProtoGenerator.class);
    htmlCompilerBinder.addBinding().to(JsonPagesIndexGenerator.class);
    htmlCompilerBinder.addBinding().to(JsonPageGenerator.class);
    MapBinder<String, ProtoCompiler> compilers = newMapBinder(binder(), String.class, ProtoCompiler.class);
    compilers.addBinding(HTML_COMPILER).to(HtmlGenerator.class);
    compilers.addBinding(JAVA_COMPILER).toProvider(JavaCompilerProvider.class);
    compilers.addBinding(ST4_COMPILER).toProvider(St4CompilerProvider.class);
    compilers.addBinding(DUMMY_COMPILER).to(DummyGenerator.class).in(Scopes.SINGLETON);
}
项目:che    文件:OpenShiftInfraModule.java   
@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);
}
项目:che    文件:LanguageServerModule.java   
@Override
protected void configure() {
  install(new LsRemoteModule());

  bind(LanguageRecognizer.class).to(DefaultLanguageRecognizer.class);
  bind(LanguageServerRegistry.class).to(LanguageServerRegistryImpl.class);
  bind(ServerInitializer.class).to(ServerInitializerImpl.class);
  bind(LanguageRegistryService.class);
  Multibinder.newSetBinder(binder(), LanguageServerLauncher.class);

  bind(WorkspaceService.class).asEagerSingleton();
  bind(TextDocumentService.class).asEagerSingleton();
  bind(PublishDiagnosticsParamsJsonRpcTransmitter.class).asEagerSingleton();
  bind(ShowMessageJsonRpcTransmitter.class).asEagerSingleton();
  Multibinder.newSetBinder(binder(), LanguageDescription.class);

  bind(LanguageServerInitializationHandler.class).asEagerSingleton();
  bind(LanguageServerFileWatcher.class).asEagerSingleton();
  bind(LanguageServerInitializationHandler.class).asEagerSingleton();
  install(new FactoryModuleBuilder().build(CheLanguageClientFactory.class));
}
项目:google-gin    文件:ResolutionModule.java   
@Override
protected void configure() {
  install(new FactoryModuleBuilder()
      .build(BindingInstaller.Factory.class));
  install(new FactoryModuleBuilder()
      .build(BindingPositioner.Factory.class));
  install(new FactoryModuleBuilder()
      .build(DependencyExplorer.Factory.class));
  install(new FactoryModuleBuilder()
      .build(ImplicitBindingCreator.Factory.class));
  install(new FactoryModuleBuilder()
      .build(UnresolvedBindingValidator.Factory.class));

  bind(BindingResolver.class);
  expose(BindingResolver.class);
}
项目:FeedExpander    文件:FeedCreatorTest.java   
private Injector createInjector() {
    return Guice.createInjector(new AbstractModule() {
        @Override
        protected void configure() {
            bindUrlLoaderFactory();
            bindFeedCreator();
        }

        private void bindUrlLoaderFactory() {
            bind(UrlLoaderFactory.class).toInstance(createUrlLoaderFactory());
        }

        private void bindFeedCreator() {
            install(new FactoryModuleBuilder().implement(FeedCreator.class, FeedCreatorImpl.class)
                    .build(FeedCreatorFactory.class));
        }

    });
}
项目:gerrit    文件:H2CacheBasedWebSession.java   
public static Module module() {
  return new CacheModule() {
    @Override
    protected void configure() {
      persist(WebSessionManager.CACHE_NAME, String.class, Val.class)
          .maximumWeight(1024) // reasonable default for many sites
          .expireAfterWrite(
              CacheBasedWebSession.MAX_AGE_MINUTES,
              MINUTES) // expire sessions if they are inactive
      ;
      install(new FactoryModuleBuilder().build(WebSessionManagerFactory.class));
      DynamicItem.itemOf(binder(), WebSession.class);
      DynamicItem.bind(binder(), WebSession.class)
          .to(H2CacheBasedWebSession.class)
          .in(RequestScoped.class);
    }
  };
}
项目:gerrit    文件:LuceneIndexModule.java   
@Override
protected void configure() {
  install(
      new FactoryModuleBuilder()
          .implement(AccountIndex.class, LuceneAccountIndex.class)
          .build(AccountIndex.Factory.class));
  install(
      new FactoryModuleBuilder()
          .implement(ChangeIndex.class, LuceneChangeIndex.class)
          .build(ChangeIndex.Factory.class));
  install(
      new FactoryModuleBuilder()
          .implement(GroupIndex.class, LuceneGroupIndex.class)
          .build(GroupIndex.Factory.class));
  install(
      new FactoryModuleBuilder()
          .implement(ProjectIndex.class, LuceneProjectIndex.class)
          .build(ProjectIndex.Factory.class));
  install(new IndexModule(threads));
  if (singleVersions == null) {
    install(new MultiVersionModule());
  } else {
    install(new SingleVersionModule(singleVersions));
  }
}
项目:gerrit    文件:ElasticIndexModule.java   
@Override
protected void configure() {
  install(
      new FactoryModuleBuilder()
          .implement(AccountIndex.class, ElasticAccountIndex.class)
          .build(AccountIndex.Factory.class));
  install(
      new FactoryModuleBuilder()
          .implement(ChangeIndex.class, ElasticChangeIndex.class)
          .build(ChangeIndex.Factory.class));
  install(
      new FactoryModuleBuilder()
          .implement(GroupIndex.class, ElasticGroupIndex.class)
          .build(GroupIndex.Factory.class));
  install(
      new FactoryModuleBuilder()
          .implement(ProjectIndex.class, ElasticProjectIndex.class)
          .build(ProjectIndex.Factory.class));

  install(new IndexModule(threads));
  if (singleVersions == null) {
    install(new MultiVersionModule());
  } else {
    install(new SingleVersionModule(singleVersions));
  }
}
项目:CRISIS    文件:FundMarketParticipationConfiguration.java   
@Override
protected void addBindings() {
   install(InjectionFactoryUtils.asPrimitiveParameterModule(
      "CREDIT_SUPPLY_FUNCTION_EXPONENT",              creditSupplyFunctionExponent,
      "CREDIT_SUPPLY_FUNCTION_MAXIMUM_INTEREST_RATE", creditSupplyFunctionMaximumInterestRate
      ));
   install(new FactoryModuleBuilder()
      .implement(
         new TypeLiteral<AgentOperation<MarketResponseFunction>>(){},
         TargetValueStockMarketResponseFunctionFactory.class
         )
      .build(TargetValueStockMarketResponseFunctionFactoryBuilder.class));
   install(new FactoryModuleBuilder()
      .implement(
         new TypeLiteral<AgentOperation<MarketResponseFunction>>(){},
         LoanSupplierMarketResponseFunctionFactory.class
         )
      .build(LoanSupplierMarketResponseFunctionFactoryBuilder.class));
   bind(ClearingMarketParticipantFactory.class)
      .annotatedWith(Names.named(getScopeString()))
      .to(FundClearingMarketParticipationFactory.class);
   expose(ClearingMarketParticipantFactory.class)
      .annotatedWith(Names.named(getScopeString()));
}
项目:CRISIS    文件:CobbDouglasProductionFunctionConfiguration.java   
@Override
protected void addBindings() {
   install(
      InjectionFactoryUtils.asPrimitiveParameterModule(
         "COBB_DOUGLAS_PRODUCTION_FUNCTION_ALPHA", alpha
         ));
   install(new FactoryModuleBuilder()
      .implement(FirmProductionFunction.class, CobbDouglasProductionFunction.class)
      .build(TechnologicalWeightsFirmProductionFunctionFactory.class)
      );
   bind(
      FirmProductionFunctionFactory.class)
      .annotatedWith(Names.named(getScopeString()))
      .to(IONetworkFirmProductionFunctionFactory.class);
   expose(
      FirmProductionFunctionFactory.class)
      .annotatedWith(Names.named(getScopeString()));
}
项目:CRISIS    文件:AssetThresholdFirmBankruptcyHandlerConfiguration.java   
@Override
protected void addBindings() {
   bind(Key.get(CashCompensationAlgorithm.class, Names.named("CASH_COMPENSATION_ALGORITHM")))
      .to(FractionOfDepositsCashCompensationAlgorithm.class);
   bind(Key.get(StockRedistributionAlgorithm.class,
      Names.named("STOCK_REDISTRIBUTION_ALGORITHM")))
      .to(DebtProportionStockRedistributionAlgorithm.class);
   install(new FactoryModuleBuilder()
      .build(SingleBeneficiaryIntermediaryFactory.class));
   if(!getScopeString().isEmpty())
      bind(Key.get(FirmBankruptcyHandler.class, Names.named(getScopeString())))
         .to(AssetThresholdFirmBankruptcyHandler.class);
   else
      bind(FirmBankruptcyHandler.class)
         .to(AssetThresholdFirmBankruptcyHandler.class);
   super.addBindings();
}
项目:CRISIS    文件:ExogenousBankSubeconomy.java   
@Override
protected void addBindings() {
   install(InjectionFactoryUtils.asPrimitiveParameterModule(
      "NUMBER_OF_SHARES_TO_EMIT_PER_BANK",               numberOfSharesToEmitPerBank,
      "INITIAL_STOCK_EMISSION_VALUE_PER_BANK",           initialStockEmissionValuePerBank,
      "BANK_STUB_STRATEGY_STOCK_RISK_PREMIUM",
         bankStockRiskPremium,
      "BANK_STUB_STRATEGY_LAG",
         trendFollowerBankLag,
      "BANK_STUB_STRATEGY_WEIGHT",
         fundamentalistChartistWeight
      ));
   install(new FactoryModuleBuilder()
      .implement(ClearingBankStrategy.class, BankStubClearingBankStrategy.class)
      .build(ClearingBankStrategyFactory.class)
      );
   bind(CommercialBank.class).to(BankStub.class);
   super.addBindings();
}
项目:CRISIS    文件:GovernmentClearingMarketResponseFunctionConfiguration.java   
@Override
protected void addBindings() {
   install(InjectionFactoryUtils.asPrimitiveParameterModule(
      "CREDIT_DEMAND_FUNCTION_EXPONENT",              creditDemandFunctionExponent,
      "CREDIT_DEMAND_FUNCTION_MAXIMUM_INTEREST_RATE", creditDemandFunctionMaximumInterestRate,
      "SHARE_SELLER_RATE_AT_WHICH_TO_SELL_SHARES",    rateAtWhichToSellOwnedShares,
      "SHARE_SELLER_THRESHOLD_AT_WHICH_TO_SELL_ALL_SHARES", criticalSaleThreshold
      ));
   install(new FactoryModuleBuilder()
      .implement(
         new TypeLiteral<AgentOperation<MarketResponseFunction>>(){},
         LoanConsumerMarketResponseFunctionFactory.class
         )
      .build(LoanConsumerMarketResponseFunctionFactoryBuilder.class));
   install(new FactoryModuleBuilder()
      .implement(
         new TypeLiteral<AgentOperation<MarketResponseFunction>>(){},
         GraduallySellSharesMarketResponseFunctionFactory.class
         )
      .build(GraduallySellSharesMarketResponseFunctionFactoryBuilder.class));
   bind(ClearingMarketParticipantFactory.class)
      .annotatedWith(Names.named(getScopeString()))
      .to(GovernmentMarketParticipationComponent.class);
   expose(ClearingMarketParticipantFactory.class)
      .annotatedWith(Names.named(getScopeString()));
}
项目:CRISIS    文件:AbstractCentralBankConfiguration.java   
@Override
protected void addBindings() {
   install(InjectionFactoryUtils.asPrimitiveParameterModule(
   "CENTRAL_BANK_INITIAL_CASH_ENDOWMENT",             centralBankInitialCashEndowment,
   "IS_CENTRAL_BANK_ENABLED",                         isCentralBankEnabled,
   "CENTRAL_BANK_STRATEGY_DO_ENABLE_TAYLOR_RULE",     doEnableCentralBankTaylorRule,
   "CENTRAL_BANK_STRATEGY_INITIAL_INTEREST_RATE",     centralBankInitialInterestRate,
   "CENTRAL_BANK_STRATEGY_INITIAL_INTEREST_RATE_SPREAD",
      centralBankInitialInterestRateSpread,
   "CENTRAL_BANK_STRATEGY_MOVING_AVERAGE_MEMORY",     centralBankMovingAverageMemory,
   "CENTRAL_BANK_STRATEGY_DO_ENABLE_OUTPUT_TRACKING", centralBankDoTrackOutput,
   "CENTRAL_BANK_STRATEGY_OUTPUT_RESPONSE_PARAMETER", centralBankOutputResponseParameter
   ));
   bind(CentralBank.class).in(Singleton.class);
   install(new FactoryModuleBuilder()
      .implement(ClearingBankStrategy.class, CentralBankStrategy.class)
      .build(CentralBankStrategyFactory.class)
      );
}
项目:CRISIS    文件:StockResellerMarketParticipationConfiguration.java   
@Override
protected void addBindings() {
   install(InjectionFactoryUtils.asPrimitiveParameterModule(
      "SHARE_SELLER_RATE_AT_WHICH_TO_SELL_SHARES",          rateAtWhichToSellOwnedShares,
      "SHARE_SELLER_THRESHOLD_AT_WHICH_TO_SELL_ALL_SHARES", criticalSaleThreshold
      ));
   install(new FactoryModuleBuilder()
      .implement(
          new TypeLiteral<AgentOperation<MarketResponseFunction>>(){},
          GraduallySellSharesMarketResponseFunctionFactory.class
          )
      .build(GraduallySellSharesMarketResponseFunctionFactoryBuilder.class)
      );
   bind(ClearingMarketParticipantFactory.class)
      .annotatedWith(Names.named(getScopeString()))
      .to(StockResellerClearingMarketParticipationFactory.class);
   expose(ClearingMarketParticipantFactory.class)
      .annotatedWith(Names.named(getScopeString()));
}
项目:CRISIS    文件:NeumannLeontieffProductionFunctionConfiguration.java   
@Override
protected void addBindings() {
   install(InjectionFactoryUtils.asPrimitiveParameterModule(
      "NEUMANN_LEONTIEFF_PRODUCTION_FUNCTION_TOTAL_FACTOR_PRODUCTIVITY",
         totalFactorProductivity,
      "NEUMANN_LEONTIEFF_PRODUCTION_FUNCTION_ALPHA",
         alpha
      ));
   install(new FactoryModuleBuilder()
      .implement(FirmProductionFunction.class, NeumannLeontieffProductionFunction.class)
      .build(TechnologicalWeightsFirmProductionFunctionFactory.class)
      );
   bind(
      FirmProductionFunctionFactory.class)
      .annotatedWith(Names.named(getScopeString()))
      .to(IONetworkFirmProductionFunctionFactory.class);
   expose(
      FirmProductionFunctionFactory.class)
      .annotatedWith(Names.named(getScopeString()));
}
项目:CRISIS    文件:MutualFundSubEconomy.java   
@Override
protected void addBindings() {
   install(InjectionFactoryUtils.asPrimitiveParameterModule(
      "NUMBER_OF_FUNDS_ARE_NOISE_TRADERS",   numberOfFundsAreNoiseTraders,
      "NOISE_TRADER_FUND_RHO",               noiseTraderFundRho,
      "NOISE_TRADER_FUND_NOISE_AMPLITUDE",   noiseTraderFundNoiseAmplitude
      ));
   install(new FactoryModuleBuilder()
      .implement(Fund.class, MutualFund.class)
      .build(MutualFundFactory.class)
      );
   install(new FactoryModuleBuilder()
      .implement(Fund.class, NoiseTraderFund.class)
      .build(NoiseTraderFundFactory.class)
      );
   bind(FundFactory.class).to(FundFactoryImpl.class).asEagerSingleton();
   expose(FundFactory.class);
   expose(Integer.class).annotatedWith(Names.named("NUMBER_OF_FUNDS_ARE_NOISE_TRADERS"));
}
项目:PerformanceHat    文件:GuiceModule.java   
@Override
protected void configure() {
  // Resource Factories for markers
  bind(FeedbackResourceFactory.class).to(FeedbackResourceFactoryImpl.class).in(Singleton.class);
  bind(FeedbackJavaResourceFactory.class).to(FeedbackJavaResourceFactoryImpl.class).in(Singleton.class);
  bind(FeedbackResourceExtensionFactory.class).to(FeedbackResourceExtensionFactoryImpl.class).in(Singleton.class);

  // Hovers
  bind(TemplateHandler.class).to(TemplateHandlerImpl.class).in(Singleton.class);

  // Cost Builder
  bind(FeedbackCleaner.class).to(CostFeedbackCleanerImpl.class).in(Singleton.class);
  bind(PredictionStrategy.class).to(PredictionStrategyImpl.class).in(Singleton.class);
  // bind(PredictionStrategy.class).to(DummyPredictionStrategyImpl.class).in(Singleton.class);

  // Feedback Handler Client
  bind(RestClient.class).to(RestClientImpl.class).in(Singleton.class);
  install(new FactoryModuleBuilder().implement(FeedbackHandlerClient.class, FeedbackHandlerClientImpl.class).build(FeedbackHandlerClientFactory.class));
  bind(FeedbackHandlerEclipseClient.class).to(FeedbackHandlerEclipseClientImpl.class).in(Singleton.class);
}