ClasspathScanner { public Map<String,AnnotationParser> scan(WarMachine war) { Map<String,AnnotationParser> result = new TreeMap<String,AnnotationParser>(); for (String fileName : war.getFilesOnClasspath()) { if (! fileName.endsWith(".class")) continue; String className = StringUtil.extractLeftOfLast(fileName, ".class").replace("/", "."); if (! applyBasePackageFilter(className)) continue; JavaClass klass = war.loadClass(className); AnnotationParser ap = new AnnotationParser(klass); if (! applyIncludedAnnotationFilter(ap)) continue; result.put(className, ap); } return result; }  ClasspathScanner addBasePackage(String packageName, boolean includeSubPackages); ClasspathScanner addBasePackage(String packageName); ClasspathScanner addIncludedAnnotation(String annotationClass); Map<String,AnnotationParser> scan(WarMachine war); Map<String,Boolean> getBasePackages(); Set<String> getIncludedAnnotations();  }
@Test public void testUnfiltered() throws Exception { WarMachine machine = TestHelpers.createWarMachine(WarNames.SERVLET); ClasspathScanner scanner = new ClasspathScanner(); Map<String,AnnotationParser> result = scanner.scan(machine); assertTrue("searching for file under WEB-INF", result.containsKey("com.example.servlet.SomeServlet")); assertTrue("searching for file in JAR", result.containsKey("net.sf.practicalxml.DomUtil")); }