本文整理汇总了Java中com.google.inject.Injector.getParent方法的典型用法代码示例。如果您正苦于以下问题:Java Injector.getParent方法的具体用法?Java Injector.getParent怎么用?Java Injector.getParent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.inject.Injector
的用法示例。
在下文中一共展示了Injector.getParent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addJaxrsClasses
import com.google.inject.Injector; //导入方法依赖的package包/类
private void addJaxrsClasses(Injector injector, List<Class<?>> classes) {
for (Key<?> key : injector.getBindings().keySet()) {
Class<?> clazz = key.getTypeLiteral().getRawType();
if (hasPathAnnotation(clazz)) {
classes.add(clazz);
}
}
while (injector.getParent() != null) {
injector = injector.getParent();
addJaxrsClasses(injector, classes);
}
}
示例2: get
import com.google.inject.Injector; //导入方法依赖的package包/类
@Override
public BeadledomClientBuilder get() {
Optional<BeadledomClientConfiguration> beadledomClientConfigOpt = beadledomConfigProvider.get(
clientBindingAnnotation);
BeadledomClientBuilder clientBuilder =
clientBuilderFactoryProvider.get(clientBindingAnnotation).create();
clientBuilder.setCorrelationIdName(correlationIdHeader);
if (beadledomClientConfigOpt.isPresent()) {
// When there is custom client config
BeadledomClientConfiguration config = beadledomClientConfigOpt.get();
if (config.correlationIdName() != null) {
clientBuilder.setCorrelationIdName(config.correlationIdName());
}
clientBuilder.setConnectionPoolSize(config.connectionPoolSize());
clientBuilder.setMaxPooledPerRouteSize(config.maxPooledPerRouteSize());
clientBuilder.setSocketTimeout(config.socketTimeoutMillis(), TimeUnit.SECONDS);
clientBuilder.setConnectionTimeout(config.connectionTimeoutMillis(), TimeUnit.SECONDS);
clientBuilder.setTtl(config.ttlMillis(), TimeUnit.SECONDS);
if (config.sslContext() != null) {
clientBuilder.sslContext(config.sslContext());
}
if (config.trustStore() != null) {
clientBuilder.trustStore(config.trustStore());
}
}
Injector tempInjector = getInjector();
processInjector(tempInjector, clientBuilder);
while (tempInjector.getParent() != null) {
tempInjector = tempInjector.getParent();
processInjector(tempInjector, clientBuilder);
}
return clientBuilder;
}
示例3: forEachBinding
import com.google.inject.Injector; //导入方法依赖的package包/类
public static void forEachBinding(Injector injector, Consumer<? super Binding<?>> consumer) {
while(injector != null) {
injector.getBindings().forEach((key, binding) -> consumer.accept(binding));
injector = injector.getParent();
}
}