本文整理汇总了Java中com.google.inject.Exposed类的典型用法代码示例。如果您正苦于以下问题:Java Exposed类的具体用法?Java Exposed怎么用?Java Exposed使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Exposed类属于com.google.inject包,在下文中一共展示了Exposed类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: provideAssetManager
import com.google.inject.Exposed; //导入依赖的package包/类
@Exposed
@Provides
@Singleton
private LanternAssetManager provideAssetManager(@Option({ "asset-repository-config", "asset-repo-config" })
@Nullable Path repoConfig, LanternPluginManager pluginManager) {
final Gson gson = new GsonBuilder().registerTypeAdapter(AssetRepository.class,
new AssetRepositoryJsonDeserializer(pluginManager)).create();
try {
URL url;
if (repoConfig != null) {
url = PathUtils.toURL(repoConfig);
} else {
url = getClass().getClassLoader().getResource("assets_repo.json");
checkNotNull(url);
}
try (BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()))) {
return new LanternAssetManager(gson.fromJson(reader, AssetRepository.class));
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:23,代码来源:LanternModule.java
示例2: getModule
import com.google.inject.Exposed; //导入依赖的package包/类
@Override
public Module getModule(Configuration configuration)
{
return new PrivateModule()
{
@Override
protected void configure()
{
bind(ObjectMapper.class).toProvider(ObjectMapperProvider.class);
bind(HttpClient.class).toInstance(new JettyHttpClient());
}
@Inject
@Provides
@Exposed
@Singleton
QueryStatsClient getQueryStatsClient(HttpClient httpClient, ObjectMapper objectMapper, @Named("presto_rest.base_uri") String prestoRestInterfaceBaseUri)
{
return new HttpQueryStatsClient(httpClient, objectMapper, URI.create(prestoRestInterfaceBaseUri));
}
};
}
开发者ID:y-lan,项目名称:presto,代码行数:23,代码来源:QueryStatsClientModuleProvider.java
示例3: CheckedProviderMethod
import com.google.inject.Exposed; //导入依赖的package包/类
CheckedProviderMethod(
Key<T> key,
Method method,
Object instance,
ImmutableSet<Dependency<?>> dependencies,
List<Provider<?>> parameterProviders,
Class<? extends Annotation> scopeAnnotation,
Class<? extends CheckedProvider> checkedProvider,
List<TypeLiteral<?>> exceptionTypes,
boolean scopeExceptions) {
this.key = key;
this.scopeAnnotation = scopeAnnotation;
this.instance = instance;
this.dependencies = dependencies;
this.method = method;
this.parameterProviders = parameterProviders;
this.exposed = method.isAnnotationPresent(Exposed.class);
this.checkedProvider = checkedProvider;
this.exceptionTypes = exceptionTypes;
this.scopeExceptions = scopeExceptions;
method.setAccessible(true);
}
开发者ID:google,项目名称:guice,代码行数:24,代码来源:CheckedProviderMethod.java
示例4: ProviderMethod
import com.google.inject.Exposed; //导入依赖的package包/类
/** @param method the method to invoke. It's return type must be the same type as {@code key}. */
private ProviderMethod(
Key<T> key,
Method method,
Object instance,
ImmutableSet<Dependency<?>> dependencies,
Class<? extends Annotation> scopeAnnotation,
Annotation annotation) {
// We can be safely initialized eagerly since our bindings must exist statically and it is an
// error for them not to.
super(InitializationTiming.EAGER);
this.key = key;
this.scopeAnnotation = scopeAnnotation;
this.instance = instance;
this.dependencies = dependencies;
this.method = method;
this.exposed = method.isAnnotationPresent(Exposed.class);
this.annotation = annotation;
}
开发者ID:google,项目名称:guice,代码行数:20,代码来源:ProviderMethod.java
示例5: testPrivateModuleInheritScanner_usingPrivateModule
import com.google.inject.Exposed; //导入依赖的package包/类
public void testPrivateModuleInheritScanner_usingPrivateModule() {
Injector injector =
Guice.createInjector(
NamedMunger.module(),
new PrivateModule() {
@Override
protected void configure() {}
@Exposed
@TestProvides
@Named("foo")
String foo() {
return "foo";
}
});
assertMungedBinding(injector, String.class, "foo", "foo");
}
开发者ID:google,项目名称:guice,代码行数:18,代码来源:ModuleAnnotatedMethodScannerTest.java
示例6: testPrivateModule_skipSourcesWithinPrivateModule
import com.google.inject.Exposed; //导入依赖的package包/类
public void testPrivateModule_skipSourcesWithinPrivateModule() {
Injector injector =
Guice.createInjector(
NamedMunger.module(),
new PrivateModule() {
@Override
protected void configure() {
binder()
.skipSources(getClass())
.install(
new AbstractModule() {
@Exposed
@TestProvides
@Named("foo")
String foo() {
return "foo";
}
});
}
});
assertMungedBinding(injector, String.class, "foo", "foo");
}
开发者ID:google,项目名称:guice,代码行数:24,代码来源:ModuleAnnotatedMethodScannerTest.java
示例7: testPrivateModule_skipSourcesForPrivateModule
import com.google.inject.Exposed; //导入依赖的package包/类
public void testPrivateModule_skipSourcesForPrivateModule() {
Injector injector =
Guice.createInjector(
NamedMunger.module(),
new AbstractModule() {
@Override
protected void configure() {
binder()
.skipSources(getClass())
.install(
new PrivateModule() {
@Override
protected void configure() {}
@Exposed
@TestProvides
@Named("foo")
String foo() {
return "foo";
}
});
}
});
assertMungedBinding(injector, String.class, "foo", "foo");
}
开发者ID:google,项目名称:guice,代码行数:26,代码来源:ModuleAnnotatedMethodScannerTest.java
示例8: testPrivateModuleInheritScanner_usingPrivateBinder
import com.google.inject.Exposed; //导入依赖的package包/类
public void testPrivateModuleInheritScanner_usingPrivateBinder() {
Injector injector =
Guice.createInjector(
NamedMunger.module(),
new AbstractModule() {
@Override
protected void configure() {
binder()
.newPrivateBinder()
.install(
new AbstractModule() {
@Exposed
@TestProvides
@Named("foo")
String foo() {
return "foo";
}
});
}
});
assertMungedBinding(injector, String.class, "foo", "foo");
}
开发者ID:google,项目名称:guice,代码行数:24,代码来源:ModuleAnnotatedMethodScannerTest.java
示例9: testPrivateModuleInheritScanner_skipSourcesFromPrivateBinder
import com.google.inject.Exposed; //导入依赖的package包/类
public void testPrivateModuleInheritScanner_skipSourcesFromPrivateBinder() {
Injector injector =
Guice.createInjector(
NamedMunger.module(),
new AbstractModule() {
@Override
protected void configure() {
binder()
.newPrivateBinder()
.skipSources(getClass())
.install(
new AbstractModule() {
@Exposed
@TestProvides
@Named("foo")
String foo() {
return "foo";
}
});
}
});
assertMungedBinding(injector, String.class, "foo", "foo");
}
开发者ID:google,项目名称:guice,代码行数:25,代码来源:ModuleAnnotatedMethodScannerTest.java
示例10: testPrivateModuleInheritScanner_skipSourcesFromPrivateBinder2
import com.google.inject.Exposed; //导入依赖的package包/类
public void testPrivateModuleInheritScanner_skipSourcesFromPrivateBinder2() {
Injector injector =
Guice.createInjector(
NamedMunger.module(),
new AbstractModule() {
@Override
protected void configure() {
binder()
.skipSources(getClass())
.newPrivateBinder()
.install(
new AbstractModule() {
@Exposed
@TestProvides
@Named("foo")
String foo() {
return "foo";
}
});
}
});
assertMungedBinding(injector, String.class, "foo", "foo");
}
开发者ID:google,项目名称:guice,代码行数:25,代码来源:ModuleAnnotatedMethodScannerTest.java
示例11: testPrivateModuleWithinPrivateModule
import com.google.inject.Exposed; //导入依赖的package包/类
public void testPrivateModuleWithinPrivateModule() {
Injector injector =
Guice.createInjector(
NamedMunger.module(),
new PrivateModule() {
@Override
protected void configure() {
expose(Key.get(String.class, named("foo-munged")));
install(
new PrivateModule() {
@Override
protected void configure() {}
@Exposed
@TestProvides
@Named("foo")
String foo() {
return "foo";
}
});
}
});
assertMungedBinding(injector, String.class, "foo", "foo");
}
开发者ID:google,项目名称:guice,代码行数:25,代码来源:ModuleAnnotatedMethodScannerTest.java
示例12: CheckedProviderMethod
import com.google.inject.Exposed; //导入依赖的package包/类
CheckedProviderMethod(
Key<T> key,
Method method,
Object instance,
ImmutableSet<Dependency<?>> dependencies,
List<Provider<?>> parameterProviders,
Class<? extends Annotation> scopeAnnotation,
Class<? extends CheckedProvider> checkedProvider,
List<TypeLiteral<?>> exceptionTypes) {
this.key = key;
this.scopeAnnotation = scopeAnnotation;
this.instance = instance;
this.dependencies = dependencies;
this.method = method;
this.parameterProviders = parameterProviders;
this.exposed = method.isAnnotationPresent(Exposed.class);
this.checkedProvider = checkedProvider;
this.exceptionTypes = exceptionTypes;
method.setAccessible(true);
}
开发者ID:cgruber,项目名称:guice-old,代码行数:22,代码来源:CheckedProviderMethod.java
示例13: provideServiceGroupMonitor
import com.google.inject.Exposed; //导入依赖的package包/类
@Provides
@Singleton
@Exposed
ServiceGroupMonitor provideServiceGroupMonitor(
CuratorFramework client,
Codec<ServiceInstance> codec) {
PathChildrenCache groupCache =
new PathChildrenCache(client, discoveryPath, true /* cacheData */);
return new CuratorServiceGroupMonitor(groupCache, MEMBER_SELECTOR, codec);
}
开发者ID:PacktPublishing,项目名称:Mastering-Mesos,代码行数:12,代码来源:CuratorServiceDiscoveryModule.java
示例14: provideSingletonService
import com.google.inject.Exposed; //导入依赖的package包/类
@Provides
@Singleton
@Exposed
SingletonService provideSingletonService(
ZooKeeperClient client,
ServerSetImpl serverSet,
@ServiceDiscoveryBindings.ZooKeeper List<ACL> zookeeperAcls) {
return new SingletonServiceImpl(
serverSet,
SingletonServiceImpl.createSingletonCandidate(client, discoveryPath, zookeeperAcls));
}
开发者ID:PacktPublishing,项目名称:Mastering-Mesos,代码行数:13,代码来源:CommonsServiceDiscoveryModule.java
示例15: provideAdminKey
import com.google.inject.Exposed; //导入依赖的package包/类
@Provides
@Singleton
@Exposed
@Named("AdminKey")
String provideAdminKey(AuthorizationConfiguration config, ApiKeyEncryption encryption) {
return configurationKeyAsPlaintext(config.getAdminApiKey(), encryption, "admin");
}
开发者ID:bazaarvoice,项目名称:emodb,代码行数:8,代码来源:SecurityModule.java
示例16: providerFor
import com.google.inject.Exposed; //导入依赖的package包/类
private EventualProvider<?> providerFor(Invokable<T, ?> method, Errors methodErrors) {
Annotation[] annotations = method.getAnnotations();
verifyMethodAccessibility(methodErrors, method, source);
@Nullable Annotation bindingAnnotation =
Annotations.findBindingAnnotation(methodErrors, method, annotations);
verifyAbsenseOfScopeAnnotation(methodErrors, annotations, source);
List<Dependency<ListenableFuture<?>>> dependencies =
Lists.newArrayListWithCapacity(method.getParameters().size());
for (Parameter parameter : method.getParameters()) {
dependencies.add(extractDependency(methodErrors, parameter));
}
Key<ListenableFuture<?>> bindingKey;
boolean exposedBinding = method.isAnnotationPresent(Exposed.class);
if (isVoid(method)) {
bindingKey = futureKey(TypeToken.of(Boolean.class), new BlackholedAnnotation());
exposedBinding = false;
} else {
bindingKey = futureKey(method.getReturnType(), bindingAnnotation);
}
return new EventualProvider<>(
method,
exposedBinding,
dependencies,
bindingKey,
scopeAnnotation,
source);
}
开发者ID:immutables,项目名称:miscellaneous,代码行数:36,代码来源:Providers.java
示例17: separator
import com.google.inject.Exposed; //导入依赖的package包/类
@Exposed
@Eventually.Provides
@Named("separator")
String separator() {
tracker.add(0);
return ":";
}
开发者ID:immutables,项目名称:miscellaneous,代码行数:8,代码来源:SampleEventuality.java
示例18: output
import com.google.inject.Exposed; //导入依赖的package包/类
@Exposed
@Eventually.Provides
@Named("output")
String output(
@Named("first") String first,
@Named("second") String second,
@Named("separator") String separator) {
tracker.add(3);
return first + separator + second;
}
开发者ID:immutables,项目名称:miscellaneous,代码行数:11,代码来源:SampleEventuality.java
示例19: provideConfigDirectory
import com.google.inject.Exposed; //导入依赖的package包/类
@Exposed
@Named(DirectoryKeys.CONFIG)
@Provides
@Singleton
private Path provideConfigDirectory(@Option({ "config-directory", "config-dir" }) @Nullable Path configDir) {
return configDir == null ? DirectoryKeys.DefaultValues.CONFIG : configDir;
}
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:8,代码来源:LanternModule.java
示例20: provideConfigDirectoryAsFile
import com.google.inject.Exposed; //导入依赖的package包/类
@Exposed
@Named(DirectoryKeys.CONFIG)
@Provides
@Singleton
private File provideConfigDirectoryAsFile(@Named(DirectoryKeys.CONFIG) Path configDir) {
return configDir.toFile();
}
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:8,代码来源:LanternModule.java
注:本文中的com.google.inject.Exposed类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论