Java 类com.google.inject.throwingproviders.ThrowingProviderBinder 实例源码

项目:bromium    文件:DefaultModule.java   
@Override
protected void configure() {
    bind(BaseRecorderFunctionFactory.class).to(PredefinedRecorderFunctionFactory.class);
    bind(FunctionRegistry.class).to(RecorderFunctionRegistry.class);
    bind(javascriptGeneratorByNameAndWebDriverActionConfiguration)
            .to(new TypeLiteral<IncludeInvokeGenerator<NameWebDriverActionConfiguration>>() {});
    bind(new TypeLiteral<JavascriptGenerator<ApplicationActionConfiguration>>(){})
            .to(RecordingWebDriverActionsOnly.class);
    bind(new TypeLiteral<FunctionRegistry<NameWebDriverActionConfiguration>>(){})
            .to(RecorderFunctionRegistry.class);
    bind(new TypeLiteral<Predicate<HttpRequest>>() {})
            .annotatedWith(Names.named(SHOULD_INJECT_JS_PREDICATE))
            .to(GetHtmlFromCurrentHostPredicate.class);

    bind(HttpRequestToTestCaseStepConverter.class)
            .annotatedWith(Names.named(CONVENTION_EVENT_DETECTOR_CONVERTOR))
            .to(SplitQueryStringOfRequest.class);

    bind(syntaxASTconverter).to(SyntaxDefinitionASTNodeConverter.class);
    bind(actionASTconverter).to(ActionASTNodeConverter.class);
    bind(conditionASTconverter).to(ConditionASTNodeConverter.class);
    bind(applicationActionASTconverter).to(ApplicationActionASTNodeConverter.class);
    bind(modelASTconverter).to(TraversingBasedASTNodeConverter.class);

    bind(ApplicationConfigurationParser.class).to(DslParser.class);

    // TODO: other OSes should have a different binding
    bind(VirtualScreenProcessCreator.class).to(UbuntuVirtualScreenProcessCreator.class);
    bindConstant().annotatedWith(Names.named(RECORD_TEMPLATE_RESOURCE)).to("/record.js");
    bindConstant().annotatedWith(Names.named(REPLAY_TEMPLATE_RESOURCE)).to("/replay.js");

    // state
    bind(RecordingState.class).in(Singleton.class);
    bind(ReplayingState.class).in(Singleton.class);

    install(ThrowingProviderBinder.forModule(this));
}
项目:pl    文件:SqlModule.java   
@Override
protected void configure() {
    requireBinding(SqlConfiguration.class);

    ThrowingProviderBinder
        .create(binder())
        .bind(DataSourceProvider.class, DataSource.class)
        .to(ConfiguredDataSourceProvider.class)
        .in(Singleton.class);
}
项目:Scaled-ML    文件:AbstractParallelModule.java   
protected void configureCommonBeans() {
    ThrowingProviderBinder.forModule(this);
    bindConstant().annotatedWith(Names.named("testOnly")).to(options.testOnly());
    bindConstant().annotatedWith(Names.named("skipFirst")).to(options.skipFirst());
    try {
        bindInputFormat();
    } catch (Exception e) {
        Throwables.propagate(e);
    }
    bind(FeaturesProcessor.class);
    bind(FtrlProximalRunner.class).asEagerSingleton();
    bind(FinishCollectStatisticsListener.class).asEagerSingleton();
    bind(Phaser.class).asEagerSingleton();
    bind(FtrlOptions.class).toInstance(options);
}
项目:mail-importer    文件:ThunderbirdModule.java   
@Override
protected void configure() {
  ThrowingProviderBinder.create(binder())
      .bind(MailProvider.class, LocalStorage.class)
      .to(ThunderbirdMailbox.class);

  bind(XMozillaStatusParser.class);
}
项目:enviroCar-server    文件:PaginationModule.java   
@Override
protected void configure() {
    ThrowingProviderBinder.create(binder())
            .bind(PaginationProvider.class, Pagination.class)
            .to(PaginationProviderImpl.class)
            .in(RequestScoped.class);
}
项目:swift-hive-metastore    文件:HiveMetastoreClientModule.java   
@Override
public void configure(final Binder binder)
{
    bindConfig(binder).to(HiveMetastoreClientConfig.class);
    thriftClientBinder(binder).bindThriftClient(HiveMetastore.class);

    binder.bind(HiveMetastoreFactory.class).to(GuiceHiveMetastoreFactory.class).in(Scopes.SINGLETON);
    ThrowingProviderBinder.create(binder).bind(HiveMetastoreProvider.class, HiveMetastore.class).to(HiveMetastoreFactory.class);
}
项目:Scaled-ML    文件:FeatureEngineeringModule.java   
@Override
protected void configure() {
    ThrowingProviderBinder.forModule(this);
    bindConstant().annotatedWith(Names.named("testOnly")).to(options.testOnly());
    bindConstant().annotatedWith(Names.named("skipFirst")).to(options.skipFirst());
    bindConstant().annotatedWith(Names.named("percentsBinningStep")).to(0.01);
    switch (options.format()) {
        case vw:
            bind(InputFormat.class).to(VowpalWabbitFormat.class);
            break;
        case csv:
            ColumnsMask columnsMask = new ColumnsMask(options.csvMask());
            bindConstant().annotatedWith(Names.named("csvDelimiter")).to(options.csvDelimiter());
            bind(new TypeLiteral<ColumnsMask>() {
            }).annotatedWith(Names.named("csvMask")).toInstance(columnsMask);
            bind(InputFormat.class).to(CSVFormat.class);
            break;
        case binary:
            bind(InputFormat.class).to(BinaryInputFormat.class);
            break;
        default:
            throw new IllegalArgumentException(options.format().toString());
    }
    bind(FirstPassRunner.class);
    bind(SecondPassRunner.class);
    bind(FeatureEngineeringRunner.class);
    bind(Phaser.class).asEagerSingleton();
    bind(FeaturesProcessor.class);
    try {
        bind(new TypeLiteral<Supplier<InputStream>>() {}).toInstance(this::openInputFile);
        bind(FastBufferedOutputStream.class).toInstance(new FastBufferedOutputStream(
                Files.newOutputStream(Paths.get(options.predictions()))));

    } catch (IOException e) {
        throw new IllegalArgumentException(e);
    }
    bind(NumericalFeaturesStatistics.class).asEagerSingleton();
    bind(new TypeLiteral<WorkHandler<TwoPhaseEvent<Void>>>() {
    })
            .to(StatisticsWorkHandler.class);
    bind(new TypeLiteral<WorkHandler<TwoPhaseEvent<SparseItem>>>() {
    })
            .to(BinningWorkHandler.class);
    bind(new TypeLiteral<EventHandler<TwoPhaseEvent<SparseItem>>>() {})
            .to(OutputWriterEventHandler.class);
}
项目:SciGraph    文件:OpenNlpModule.java   
@Override
protected void configure() {
  install(ThrowingProviderBinder.forModule(this));
}