@Test public void test_scan_ScanJar() { ClassLoader loader = Thread.currentThread().getContextClassLoader(); URL url = loader.getResource("flapjack-annotation-test-helper.jar"); Thread.currentThread().setContextClassLoader(new URLClassLoader(new URL[]{url}, loader)); RecordPackageClassScanner scanner = new RecordPackageClassScanner(); List<Class<?>> classes = scanner.scan(Arrays.<String>asList("flapjack.annotation.test")); assertNotNull(classes); assertEquals(1, classes.size()); assertEquals("flapjack.annotation.test.Dog", classes.get(0).getName()); }
public List<Class<?>> scan(List<String> packages) { List<Class<?>> classes = new ArrayList<Class<?>>(); for (String packageName : packages) { for (Class clazz : findClassesInPackage(packageName)) { if (hasRecordAnnoation(clazz)) classes.add(clazz); } } return classes; }
RecordPackageClassScanner { public List<Class<?>> scan(List<String> packages) { List<Class<?>> classes = new ArrayList<Class<?>>(); for (String packageName : packages) { for (Class clazz : findClassesInPackage(packageName)) { if (hasRecordAnnoation(clazz)) classes.add(clazz); } } return classes; } }
RecordPackageClassScanner { public List<Class<?>> scan(List<String> packages) { List<Class<?>> classes = new ArrayList<Class<?>>(); for (String packageName : packages) { for (Class clazz : findClassesInPackage(packageName)) { if (hasRecordAnnoation(clazz)) classes.add(clazz); } } return classes; }  }
RecordPackageClassScanner { public List<Class<?>> scan(List<String> packages) { List<Class<?>> classes = new ArrayList<Class<?>>(); for (String packageName : packages) { for (Class clazz : findClassesInPackage(packageName)) { if (hasRecordAnnoation(clazz)) classes.add(clazz); } } return classes; }  List<Class<?>> scan(List<String> packages); }
RecordPackageClassScanner { public List<Class<?>> scan(List<String> packages) { List<Class<?>> classes = new ArrayList<Class<?>>(); for (String packageName : packages) { for (Class clazz : findClassesInPackage(packageName)) { if (hasRecordAnnoation(clazz)) classes.add(clazz); } } return classes; }  List<Class<?>> scan(List<String> packages);  }