@Test public void test_archive_scan() throws IOException { InstanceOfFilter filter = new InstanceOfFilter(CommandMap.class); ClasspathScanner scanner = new ClasspathScanner(filter); scanner.scan(new File("./src/test/resources/classpathscan-test.jar").toURI().toURL()); List<Class<?>> classes = filter.getMatchedTypes(); Assert.assertTrue(classes.contains(CommandMap.class)); Assert.assertTrue(classes.contains(MailcapCommandMap.class)); }
public void scan(URL url) throws IOException { File file = toClassPathFile(url); if (file.exists()) { if (file.isDirectory()) { handleDirectory(file, url.getRef()); } else { handleArchive(file); } } else { CommonCoreLogger.ROOT_LOGGER.unknownClasspathURL(file.getAbsolutePath()); } }
ClasspathScanner { public void scan(URL url) throws IOException { File file = toClassPathFile(url); if (file.exists()) { if (file.isDirectory()) { handleDirectory(file, url.getRef()); } else { handleArchive(file); } } else { CommonCoreLogger.ROOT_LOGGER.unknownClasspathURL(file.getAbsolutePath()); } } }
ClasspathScanner { public void scan(URL url) throws IOException { File file = toClassPathFile(url); if (file.exists()) { if (file.isDirectory()) { handleDirectory(file, url.getRef()); } else { handleArchive(file); } } else { CommonCoreLogger.ROOT_LOGGER.unknownClasspathURL(file.getAbsolutePath()); } } ClasspathScanner(Filter filter); }
ClasspathScanner { public void scan(URL url) throws IOException { File file = toClassPathFile(url); if (file.exists()) { if (file.isDirectory()) { handleDirectory(file, url.getRef()); } else { handleArchive(file); } } else { CommonCoreLogger.ROOT_LOGGER.unknownClasspathURL(file.getAbsolutePath()); } } ClasspathScanner(Filter filter); void scan(URL url); static File toClassPathFile(URL classPathURL); }
ClasspathScanner { public void scan(URL url) throws IOException { File file = toClassPathFile(url); if (file.exists()) { if (file.isDirectory()) { handleDirectory(file, url.getRef()); } else { handleArchive(file); } } else { CommonCoreLogger.ROOT_LOGGER.unknownClasspathURL(file.getAbsolutePath()); } } ClasspathScanner(Filter filter); void scan(URL url); static File toClassPathFile(URL classPathURL);  }