use of com.google.inject.spi.DefaultElementVisitor in project guice by google.
the class Modules method extractScanners.
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());
}
}
};
}
Aggregations