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