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(); } }
@Override public Object scan(Vfs.File file, Object classObject) { getStore().put(file.getName(), file.getRelativePath()); return classObject; }
InputStream inputStream = null; try { inputStream = file.openInputStream(); reflections.merge(serializer.read(inputStream)); } catch (IOException e) {
InputStream inputStream = null; try { inputStream = file.openInputStream(); reflections.merge(serializer.read(inputStream)); } catch (IOException e) {
InputStream inputStream = null; try { inputStream = file.openInputStream(); reflections.merge(serializer.read(inputStream)); } catch (IOException e) {
Iterable<Vfs.File> files = Vfs.findFiles(urls , packagePrefix , resourceNameFilter); for (final Vfs.File file : files) { LOGGER.info("scanning VFS file : " + file.getRelativePath() + "/" + file.getName()); InputStream inputStream = null; try { inputStream = file.openInputStream(); reflections.merge(serializer.read(inputStream)); } catch (IOException e) {
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 (LOGGER != null && LOGGER.isFineEnabled()) LOGGER.fine("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.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.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(); } }
public Class getOfCreateClassObject(Vfs.File file, @Nullable ClassLoader... loaders) throws Exception { String name = file.getRelativePath().replace("/", ".").replace(".class", ""); return forName(name, loaders); }
public Class getOfCreateClassObject(Vfs.File file , @Nullable ClassLoader... loaders) throws Exception { String name = file.getRelativePath().replace("/" , ".").replace(".class" , ""); return forName(name , loaders); }
@Override public Object scan(Vfs.File file, Object classObject) { getStore().put(file.getName(), file.getRelativePath()); return classObject; }
@Override public Object scan(Vfs.File file, Object classObject) { getStore().put(file.getName(), file.getRelativePath()); return classObject; }
public boolean apply(File file) { String path = file.getRelativePath(); if (path.startsWith(packagePrefix)) { String filename = path.substring(path.indexOf(packagePrefix) + packagePrefix.length()); return !Utils.isEmpty(filename) && nameFilter.apply(filename.substring(1)); } else { return false; } } };
public Object scan(Vfs.File file, Object classObject) { if (classObject == null) { try { classObject = configuration.getMetadataAdapter().getOfCreateClassObject(file); } catch (Exception e) { throw new ReflectionsException("could not create class object from file " + file.getRelativePath(), e); } } scan(classObject); return classObject; }
@Override public void scan(File file) { String relativePath = file.getRelativePath(); if (relativePath.startsWith(META_INF) && relativePath.endsWith(RESOURCE_PROPERTIES_EXT)) { Multimap<String, String> store = getStore(); String className = relativePath.substring(META_INF.length(), relativePath.length() - RESOURCE_PROPERTIES_EXT.length()); store.put(STORE_KEY, className); } }
public static Iterable<File> findFiles(final Collection<URL> inUrls , final String packagePrefix , final Predicate<String> nameFilter) { Predicate<File> fileNamePredicate = file -> { String path = file.getRelativePath(); if (path.startsWith(packagePrefix)) { String filename = path.substring(path.indexOf(packagePrefix) + packagePrefix.length()); return ! Utils.isEmpty(filename) && nameFilter.apply(filename.substring(1)); } else { return false; } }; return findFiles(inUrls , fileNamePredicate); }
public boolean apply(File file) { String path = file.getRelativePath(); if (path.startsWith(packagePrefix)) { String filename = path.substring(path.indexOf(packagePrefix) + packagePrefix.length()); return !Utils.isEmpty(filename) && nameFilter.apply(filename.substring(1)); } else { return false; } } };
@Override public Object scan(Vfs.File file, Object classObject) { if (classObject == null) { try { classObject = configuration.getMetadataAdapter().getOfCreateClassObject(file); } catch (Exception e) { throw new ReflectionsException("could not create class object from file " + file.getRelativePath()); } } scan(classObject); return classObject; }
@Override public Object scan(Vfs.File file , Object classObject) { getStore().put(file.getName() , file.getRelativePath()); return classObject; }