/** tries to create a Dir from the given url, using the defaultUrlTypes */ public static Dir fromURL(final URL url) { return fromURL(url, defaultUrlTypes); }
/** tries to create a Dir from the given url, using the defaultUrlTypes */ public static Dir fromURL(final URL url) { return fromURL(url, defaultUrlTypes); }
/** tries to create a Dir from the given url, using the given urlTypes*/ public static Dir fromURL(final URL url, final UrlType... urlTypes) { return fromURL(url, Lists.<UrlType>newArrayList(urlTypes)); }
/** tries to create a Dir from the given url, using the given urlTypes*/ public static Dir fromURL(final URL url, final UrlType... urlTypes) { return fromURL(url, Lists.<UrlType>newArrayList(urlTypes)); }
public Dir createDir(URL url) throws Exception { return fromURL((URL) ClasspathHelper.contextClassLoader(). loadClass("org.eclipse.core.runtime.FileLocator").getMethod("resolve", URL.class).invoke(null, url)); } },
public Dir createDir(URL url) throws Exception { return fromURL((URL) ClasspathHelper.contextClassLoader(). loadClass("org.eclipse.core.runtime.FileLocator").getMethod("resolve", URL.class).invoke(null, url)); } },
public Iterator<File> iterator() { return fromURL(url).getFiles().iterator(); } }, filePredicate));
public Iterator<File> iterator() { return fromURL(url).getFiles().iterator(); } }, filePredicate));
protected void scan(URL url) { Vfs.Dir dir = Vfs.fromURL(url); try { for (final Vfs.File file : dir.getFiles()) { // scan if inputs filter accepts file relative path or fqn Predicate<String> inputsFilter = configuration.getInputsFilter(); String path = file.getRelativePath(); String fqn = path.replace('/', '.'); if (inputsFilter == null || inputsFilter.apply(path) || inputsFilter.apply(fqn)) { Object classObject = null; for (Scanner scanner : configuration.getScanners()) { try { if (scanner.acceptsInput(path) || scanner.acceptResult(fqn)) { classObject = scanner.scan(file, classObject); } } catch (Exception e) { if (log != null && log.isDebugEnabled()) log.debug("could not scan file " + file.getRelativePath() + " in url " + url.toExternalForm() + " with scanner " + scanner.getClass().getSimpleName(), e); } } } } } finally { dir.close(); } }
protected void scan(URL url) { Vfs.Dir dir = Vfs.fromURL(url); try { for (final Vfs.File file : dir.getFiles()) { // scan if inputs filter accepts file relative path or fqn Predicate<String> inputsFilter = configuration.getInputsFilter(); String path = file.getRelativePath(); String fqn = path.replace('/', '.'); if (inputsFilter == null || inputsFilter.apply(path) || inputsFilter.apply(fqn)) { Object classObject = null; for (Scanner scanner : configuration.getScanners()) { try { if (scanner.acceptsInput(path) || scanner.acceptsInput(fqn)) { classObject = scanner.scan(file, classObject); } } catch (Exception e) { if (log != null) { // SLF4J will filter out Throwables from the format string arguments. log.debug("could not scan file {} in url {} with scanner {}", file.getRelativePath(), url.toExternalForm(), scanner.getClass().getSimpleName(), e); } } } } } } finally { dir.close(); } }
public static Dir fromURL(final URL url) { return fromURL(url , defaultUrlTypes); }
/** tries to create a Dir from the given url, using the defaultUrlTypes */ public static Dir fromURL(final URL url) { return fromURL(url, defaultUrlTypes); }
/** tries to create a Dir from the given url, using the given urlTypes*/ public static Dir fromURL(final URL url, final UrlType... urlTypes) { return fromURL(url, Lists.<UrlType>newArrayList(urlTypes)); }
public static Dir fromURL(final URL url , final UrlType... urlTypes) { return fromURL(url , Arrays.asList(urlTypes)); }
public Dir createDir(URL url) throws Exception { return fromURL((URL) ClasspathHelper.contextClassLoader(). loadClass("org.eclipse.core.runtime.FileLocator").getMethod("resolve" , URL.class).invoke(null , url)); } },
public Dir createDir(URL url) throws Exception { return fromURL((URL) ClasspathHelper.contextClassLoader(). loadClass("org.eclipse.core.runtime.FileLocator").getMethod("resolve", URL.class).invoke(null, url)); } },
public Dir createDir(URL url) throws Exception { return fromURL((URL) ClasspathHelper.contextClassLoader(). loadClass("org.eclipse.core.runtime.FileLocator").getMethod("resolve", URL.class).invoke(null, url)); } },
public Iterator<File> iterator() { return fromURL(url).getFiles().iterator(); } }, filePredicate));
public Iterator<File> iterator() { return fromURL(url).getFiles().iterator(); } }, filePredicate));
public static Iterable<File> findFiles(final Collection<URL> inUrls , final Predicate<File> filePredicate) { Iterable<File> result = new ArrayList<>(); for (final URL url : inUrls) { try { result = Iterables .concat(result , Iterables.filter(() -> fromURL(url).getFiles().iterator() , filePredicate) ); } catch (Throwable e) { final LoggingService log = Logger.getLogger(Reflections.class); if (log != null) { log.warning("could not findFiles for url. continuing. [" + url + "]" , e); } } } return result; }