本文整理汇总了Java中com.google.inject.Binder.bind方法的典型用法代码示例。如果您正苦于以下问题:Java Binder.bind方法的具体用法?Java Binder.bind怎么用?Java Binder.bind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.inject.Binder
的用法示例。
在下文中一共展示了Binder.bind方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setup
import com.google.inject.Binder; //导入方法依赖的package包/类
@Override
protected void setup(Binder binder)
{
binder.disableCircularProxies();
binder.bind(AgentMap.class).to(DiscoveryAgentMap.class).in(Scopes.SINGLETON);
binder.bind(RequestDispatcher.class).in(Scopes.SINGLETON);
binder.bind(Client.class).to(JerseyClient.class).in(Scopes.SINGLETON);
binder.bind(ResponseWrapper.class);
jaxrsBinder(binder).bind(ControllerConfigAPI.class);
jaxrsBinder(binder).bind(ControllerConnectorAPI.class);
jaxrsBinder(binder).bind(ControllerLogsAPI.class);
jaxrsBinder(binder).bind(ControllerPackageAPI.class);
jaxrsBinder(binder).bind(ControllerControlAPI.class);
jaxrsBinder(binder).bind(InstantConverterProvider.class);
discoveryBinder(binder).bindSelector("presto-manager");
}
示例2: configure
import com.google.inject.Binder; //导入方法依赖的package包/类
/**
* Every binding must explicitly mentioned here.
*/
@Override
public void configure(Binder binder) {
binder.bind(IResourceSetInitializer.class).to(BuiltInSchemeResourceSetInitializer.class);
binder.bind(BuiltInSchemeRegistrar.class);
binder.bind(ClassLoader.class).toInstance(ContributingModule.class.getClassLoader());
}
示例3: ListProvider
import com.google.inject.Binder; //导入方法依赖的package包/类
public ListProvider(Binder binder, List<Class<? extends T>> clazzes)
{
this.binder = binder;
this.clazzes.addAll(clazzes);
for( Class<? extends T> clazz : clazzes )
{
binder.bind(clazz);
}
}
示例4: configure
import com.google.inject.Binder; //导入方法依赖的package包/类
@Override
public void configure(Binder binder) {
binder.bind(IStorage2UriMapperContribution.class).to(BuiltinSchemeUriMapperContribution.class);
binder.bind(BuiltInSchemeRegistrar.class);
binder.bind(ClassLoader.class).toInstance(getClass().getClassLoader());
}
示例5: setup
import com.google.inject.Binder; //导入方法依赖的package包/类
@Override
protected void setup(Binder binder)
{
binder.disableCircularProxies();
// buildConfigObject also calls bindConfig
AgentConfig config = buildConfigObject(AgentConfig.class);
switch (config.getPackageType()) {
case RPM:
configBinder(binder).bindConfig(PrestoRpmConfig.class, "presto");
binder.bind(PrestoConfig.class).to(PrestoRpmConfig.class);
binder.bind(PackageController.class).to(RpmController.class)
.in(Scopes.SINGLETON);
break;
case TARBALL:
configBinder(binder).bindConfig(PrestoTarConfig.class, "presto");
binder.bind(PrestoConfig.class).to(PrestoTarConfig.class);
binder.bind(PackageController.class).to(TarController.class)
.in(Scopes.SINGLETON);
break;
default:
throw new IllegalArgumentException("Unsupported package type");
}
binder.bind(Client.class).to(JerseyClient.class).in(Scopes.SINGLETON);
binder.bind(LogsHandler.class).in(Scopes.SINGLETON);
binder.bind(PrestoInformer.class);
binder.bind(CommandExecutor.class);
binder.bind(PrestoConfigDeployer.class);
jaxrsBinder(binder).bind(ConfigAPI.class);
jaxrsBinder(binder).bind(ConnectorsAPI.class);
jaxrsBinder(binder).bind(ControlAPI.class);
jaxrsBinder(binder).bind(LogsAPI.class);
jaxrsBinder(binder).bind(PackageAPI.class);
jaxrsBinder(binder).bind(InstantConverterProvider.class);
discoveryBinder(binder).bindHttpAnnouncement("presto-manager");
dynamicAnnouncementBinder(binder).forService("presto-manager")
.bindProperty("configured-presto-coordinator")
.toClassFromGetter(PrestoInformer.class,
informer -> {
try {
return Boolean.toString(informer.isConfiguredCoordinator());
}
catch (IOException e) {
return null;
}
});
}