下面列出了怎么用com.google.inject.throwingproviders.ThrowingProviderBinder的API类实例代码及写法,或者点击链接到github查看源代码。
@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));
}
@Override
protected void configure() {
ThrowingProviderBinder.create(binder())
.bind(MailProvider.class, LocalStorage.class)
.to(ThunderbirdMailbox.class);
bind(XMozillaStatusParser.class);
}
@Override
protected void configure() {
install(ThrowingProviderBinder.forModule(this));
}