本文整理了Java中com.google.inject.spi.Element.acceptVisitor()
方法的一些代码示例,展示了Element.acceptVisitor()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.acceptVisitor()
方法的具体详情如下:
包路径:com.google.inject.spi.Element
类名称:Element
方法名:acceptVisitor
[英]Accepts an element visitor. Invokes the visitor method specific to this element's type.
[中]接受元素访问者。调用特定于此元素类型的访问者方法。
代码示例来源:origin: com.google.inject/guice
void writeAll(Iterable<? extends Element> elements) {
for (Element element : elements) {
element.acceptVisitor(this);
}
}
}
代码示例来源:origin: com.google.inject/guice
private static Module extractScanners(Iterable<Element> elements) {
final List<ModuleAnnotatedMethodScannerBinding> scanners = Lists.newArrayList();
ElementVisitor<Void> visitor =
new DefaultElementVisitor<Void>() {
@Override
public Void visit(ModuleAnnotatedMethodScannerBinding binding) {
scanners.add(binding);
return null;
}
};
for (Element element : elements) {
element.acceptVisitor(visitor);
}
return new AbstractModule() {
@Override
protected void configure() {
for (ModuleAnnotatedMethodScannerBinding scanner : scanners) {
scanner.applyTo(binder());
}
}
};
}
}
代码示例来源:origin: com.google.inject/guice
public void process(InjectorImpl injector, List<Element> elements) {
Errors errorsAnyElement = this.errors;
this.injector = injector;
try {
for (Iterator<Element> i = elements.iterator(); i.hasNext(); ) {
Element element = i.next();
this.errors = errorsAnyElement.withSource(element.getSource());
Boolean allDone = element.acceptVisitor(this);
if (allDone) {
i.remove();
}
}
} finally {
this.errors = errorsAnyElement;
this.injector = null;
}
}
代码示例来源:origin: org.sonatype.sisu/sisu-guice
void writeAll(Iterable<? extends Element> elements) {
for (Element element : elements) {
element.acceptVisitor(this);
}
}
}
代码示例来源:origin: ArcBees/Jukito
private void visitElements(List<Element> elements) {
for (Element element : elements) {
element.acceptVisitor(this);
}
}
代码示例来源:origin: org.jukito/jukito
private void visitElements(List<Element> elements) {
for (Element element : elements) {
element.acceptVisitor(this);
}
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/com.google.inject
void writeAll(Iterable<? extends Element> elements) {
for (Element element : elements) {
element.acceptVisitor(this);
}
}
}
代码示例来源:origin: com.jwebmp.inject/guice
void writeAll(Iterable<? extends Element> elements) {
for (Element element : elements) {
element.acceptVisitor(this);
}
}
}
代码示例来源:origin: com.google/inject
void writeAll(Iterable<? extends Element> elements) {
for (Element element : elements) {
element.acceptVisitor(this);
}
}
}
代码示例来源:origin: org.xbib/guice
void writeAll(Iterable<? extends Element> elements) {
for (Element element : elements) {
element.acceptVisitor(this);
}
}
}
代码示例来源:origin: Nextdoor/bender
void writeAll(Iterable<? extends Element> elements) {
for (Element element : elements) {
element.acceptVisitor(this);
}
}
}
代码示例来源:origin: com.googlecode.gwt-test-utils/gwt-test-utils
private Set<Key<?>> collectBindedClasses(List<Element> elements) {
final Set<Key<?>> bindedClasses = new HashSet<>();
for (Element e : elements) {
e.acceptVisitor(new DefaultElementVisitor<Void>() {
@Override
public <T> Void visit(Binding<T> binding) {
bindedClasses.add(binding.getKey());
return null;
}
});
}
return bindedClasses;
}
代码示例来源:origin: gwt-test-utils/gwt-test-utils
private Set<Key<?>> collectBindedClasses(List<Element> elements) {
final Set<Key<?>> bindedClasses = new HashSet<>();
for (Element e : elements) {
e.acceptVisitor(new DefaultElementVisitor<Void>() {
@Override
public <T> Void visit(Binding<T> binding) {
bindedClasses.add(binding.getKey());
return null;
}
});
}
return bindedClasses;
}
代码示例来源:origin: com.proofpoint.platform/configuration
@Override
public Void visit(PrivateElements privateElements)
{
for (Element element : privateElements.getElements()) {
element.acceptVisitor(this);
}
return null;
}
});
代码示例来源:origin: com.netflix.governator/governator-core
/**
* Call the provided visitor for all elements of the current module.
*
* This call will not modify any bindings
* @param visitor
*/
public <T> InjectorBuilder forEachElement(ElementVisitor<T> visitor) {
Elements
.getElements(module)
.forEach(element -> element.acceptVisitor(visitor));
return this;
}
代码示例来源:origin: io.github.gwtplus.gin/gin
private void visitElements(List<Element> elements) {
// We take advantage of the fact that iterating over the PrivateElements should
// happen in the same order that the modules were installed. We match each PrivateElements
// up with the {@link GinjectorBindings} that were created in the adapter.
children = bindings.getChildren().iterator();
for (Element element : elements) {
element.acceptVisitor(this);
}
}
代码示例来源:origin: com.netflix.governator/governator
@Override
public Collection<Module> call(Collection<Module> modules) {
for(Element element : Elements.getElements(Stage.TOOL, modules)) {
element.acceptVisitor(new DefaultElementVisitor<Void>() {
@Override
public Void visit(StaticInjectionRequest request) {
LOG.warn("You shouldn't be using static injection at: " + request.getSource());
return null;
}
});
}
return modules;
}
代码示例来源:origin: com.netflix.governator/governator-core
/**
* Iterate through all elements of the current module and pass the output of the
* ElementVisitor to the provided consumer. 'null' responses from the visitor are ignored.
*
* This call will not modify any bindings
* @param visitor
*/
public <T> InjectorBuilder forEachElement(ElementVisitor<T> visitor, Consumer<T> consumer) {
Elements
.getElements(module)
.forEach(element -> Optional.ofNullable(element.acceptVisitor(visitor)).ifPresent(consumer));
return this;
}
代码示例来源:origin: com.yahoo.vespa/jdisc_core
private Module createModule() {
List<Element> allElements = new LinkedList<>();
for (List<Element> moduleElements : modules.values()) {
allElements.addAll(moduleElements);
}
ElementCollector collector = new ElementCollector();
for (ListIterator<Element> it = allElements.listIterator(allElements.size()); it.hasPrevious(); ) {
it.previous().acceptVisitor(collector);
}
return Elements.getModule(collector.elements);
}
代码示例来源:origin: com.atlassian.org.eclipse.sisu/org.eclipse.sisu.inject
public void configure( final Binder binder )
{
final ElementMerger merger = new ElementMerger( binder );
for ( final Module m : modules )
{
for ( final Element e : Elements.getElements( m ) )
{
e.acceptVisitor( merger );
}
}
}
}
内容来源于网络,如有侵权,请联系作者删除!