本文整理匯總了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;
}
});
}