本文整理汇总了Java中com.google.inject.spi.ProviderLookup类的典型用法代码示例。如果您正苦于以下问题:Java ProviderLookup类的具体用法?Java ProviderLookup怎么用?Java ProviderLookup使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProviderLookup类属于com.google.inject.spi包,在下文中一共展示了ProviderLookup类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: containsElement
import com.google.inject.spi.ProviderLookup; //导入依赖的package包/类
public boolean containsElement(com.google.inject.spi.Element element) {
if (mapBinder.containsElement(element)) {
return true;
} else {
Key<?> elementKey;
if (element instanceof Binding) {
elementKey = ((Binding<?>) element).getKey();
} else if (element instanceof ProviderLookup) {
elementKey = ((ProviderLookup<?>) element).getKey();
} else {
return false; // cannot match;
}
return elementKey.equals(optionalKey)
|| elementKey.equals(optionalProviderKey)
|| elementKey.equals(optionalJavaxProviderKey)
|| matchesTypeKey(element, elementKey)
|| matchesUserBinding(elementKey);
}
}
开发者ID:cgruber,项目名称:guice-old,代码行数:21,代码来源:OptionalBinder.java
示例2: containsElement
import com.google.inject.spi.ProviderLookup; //导入依赖的package包/类
boolean containsElement(com.google.inject.spi.Element element) {
if (entrySetBinder.containsElement(element)) {
return true;
} else {
Key<?> key;
if (element instanceof Binding) {
key = ((Binding<?>)element).getKey();
} else if (element instanceof ProviderLookup) {
key = ((ProviderLookup<?>)element).getKey();
} else {
return false; // cannot match;
}
return key.equals(mapKey)
|| key.equals(providerMapKey)
|| key.equals(javaxProviderMapKey)
|| key.equals(multimapKey)
|| key.equals(providerMultimapKey)
|| key.equals(entrySetBinder.getSetKey())
|| matchesValueKey(key);
}
}
开发者ID:cgruber,项目名称:guice-old,代码行数:23,代码来源:MapBinder.java
示例3: visit
import com.google.inject.spi.ProviderLookup; //导入依赖的package包/类
@Override
public <T> Void visit(ProviderLookup<T> providerLookup)
{
dependencyAnalyzer.addDependency(providerLookup.getKey());
providerLookup.applyTo(binder);
return null;
}
开发者ID:equella,项目名称:Equella,代码行数:8,代码来源:ElementAnalyzer.java
示例4: assertAllDependenciesDeclared
import com.google.inject.spi.ProviderLookup; //导入依赖的package包/类
public void assertAllDependenciesDeclared() {
List<Key> requiredKeys = new ArrayList<>();
List<Element> elements = Elements.getElements(module);
for (Element element : elements) {
element.acceptVisitor(new DefaultElementVisitor<Void>() {
@Override
public <T> Void visit(ProviderLookup<T> providerLookup) {
// Required keys are the only ones with null injection points.
if (providerLookup.getDependency().getInjectionPoint() == null) {
requiredKeys.add(providerLookup.getKey());
}
return null;
}
});
}
Injector injector = Guice.createInjector(module,
new AbstractModule() {
@Override
@SuppressWarnings("unchecked")
protected void configure() {
binder().disableCircularProxies();
binder().requireAtInjectOnConstructors();
binder().requireExactBindingAnnotations();
for (Key<?> key : requiredKeys) {
bind((Key) key).toProvider(Providers.of(null));
}
}
});
injector.getAllBindings();
}
开发者ID:google,项目名称:mail-importer,代码行数:35,代码来源:ModuleTester.java
示例5: visit
import com.google.inject.spi.ProviderLookup; //导入依赖的package包/类
@Override
public <T> Boolean visit(ProviderLookup<T> lookup) {
// ensure the provider can be created
try {
Provider<T> provider = injector.getProviderOrThrow(lookup.getDependency(), errors);
lookup.initializeDelegate(provider);
} catch (ErrorsException e) {
errors.merge(e.getErrors()); // TODO: source
}
return true;
}
开发者ID:google,项目名称:guice,代码行数:13,代码来源:LookupProcessor.java
示例6: visit
import com.google.inject.spi.ProviderLookup; //导入依赖的package包/类
@Override public <T> Boolean visit(ProviderLookup<T> lookup) {
// ensure the provider can be created
try {
Provider<T> provider = injector.getProviderOrThrow(lookup.getKey(), errors);
lookup.initializeDelegate(provider);
} catch (ErrorsException e) {
errors.merge(e.getErrors()); // TODO: source
}
return true;
}
开发者ID:cgruber,项目名称:guice-old,代码行数:12,代码来源:LookupProcessor.java
示例7: visit
import com.google.inject.spi.ProviderLookup; //导入依赖的package包/类
@Override
public <T> V visit(ProviderLookup<T> lookup) {
return message(lookup,
"Looking up provider " + lookup.getProvider() +
" for key " + lookup.getKey());
}
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:7,代码来源:ElementInspector.java
示例8: visit
import com.google.inject.spi.ProviderLookup; //导入依赖的package包/类
@Override
public <T> Object visit(ProviderLookup<T> providerLookup) {
processDependency(providerLookup.getDependency());
return super.visit(providerLookup);
}
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:6,代码来源:DependencyCollector.java
示例9: visit
import com.google.inject.spi.ProviderLookup; //导入依赖的package包/类
public <T> Void visit(ProviderLookup<T> providerLookup) {
// Ignore provider lookups for now
// TODO(bstoler): I guess we should error if you try to lookup a provider
// that is not bound?
return null;
}
开发者ID:google-code-export,项目名称:google-gin,代码行数:7,代码来源:GuiceElementVisitor.java
示例10: getProvider
import com.google.inject.spi.ProviderLookup; //导入依赖的package包/类
@Override
public <T> Provider<T> getProvider(Key<T> key) {
ProviderLookup<T> lookup = new ProviderLookup<>(key, key);
lookups.add(lookup);
return lookup.getProvider();
}
开发者ID:google,项目名称:guice,代码行数:7,代码来源:DeferredLookups.java
示例11: getProvider
import com.google.inject.spi.ProviderLookup; //导入依赖的package包/类
public <T> Provider<T> getProvider(Key<T> key) {
ProviderLookup<T> lookup = new ProviderLookup<T>(key, key);
lookups.add(lookup);
return lookup.getProvider();
}
开发者ID:cgruber,项目名称:guice-old,代码行数:6,代码来源:DeferredLookups.java
注:本文中的com.google.inject.spi.ProviderLookup类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论