private SortedSet<URI> getClasspathSet(final List<Class<?>> classes) { Collection<String> classResources = new ArrayList<>(); for (Class<?> cl : classes) { classResources.add(Converter.toResource(cl)); } return this.classpathDigger.getResourcepathSet(classResources); }
/** * Which class path. * * @param p * the p * * @return the uRI */ public URI whichClassPath(final Package p) { String resource = Converter.toResource(p); return whichResourcePath(resource); }
/** * Which class path. * * @param p the p * * @return the uRI */ public URI whichClassPath(final Package p) { String resource = Converter.toResource(p); return whichResourcePath(resource); }
/** * Gets the parent of the given class. * * @param path * e.g. "jar:file:/a/b/c.jar!/d/e.class * @param clazz * e.gl. "d.e.class" * @return e.g. "jar:file:/a/b/c.jar" */ public static URI getParent(final URI path, final Class<?> clazz) { String resource = Converter.toResource(clazz); return getParent(path, resource); }
/** * Gets the classpath set. * * @param classes the classes * * @return the classpath set */ private SortedSet<URI> getClasspathSet(final List<Class<?>> classes) { SortedSet<URI> classpath = new TreeSet<URI>(); for (Class<?> cl : classes) { String resource = Converter.toResource(cl); Enumeration<URL> resources = this.getResources(resource); while (resources.hasMoreElements()) { URL url = resources.nextElement(); URI path = Converter.toURI(url); classpath.add(ClasspathHelper.getParent(path, resource)); } } return classpath; }
String resource = Converter.toResource(clazz); return getParent(path, resource);
/** * Here we use the loaded packages to calculate the classpath. For each * loaded package we will look from which jar file or directory this package * is loaded. * * @return the found classpath as string array * @since 27-Jul-2009 */ protected String[] getClasspathFromPackages() { Set<URI> packageURIs = new LinkedHashSet<>(); Package[] packages = this.getLoadedPackageArray(); for (int i = 0; i < packages.length; i++) { String resource = Converter.toResource(packages[i]); URI uri = ResourcepathDigger.whichResource(resource, this.classLoader); if (uri != null) { URI path = ClasspathHelper.getParent(uri, resource); packageURIs.add(path); } } return getClasspathFromPackages(packageURIs); }
/** * Here we use the loaded packages to calculate the classpath. For each * loaded package we will look from which jar file or directory this * package is loaded. * * @return the found classpath as string array * @since 27-Jul-2009 */ protected String[] getClasspathFromPackages() { Set<URI> packageURIs = new LinkedHashSet<URI>(); Package[] packages = this.getLoadedPackageArray(); for (int i = 0; i < packages.length; i++) { String resource = Converter.toResource(packages[i]); URI uri = whichResource(resource, this.classLoader); if (uri != null) { URI path = ClasspathHelper.getParent(uri, resource); packageURIs.add(path); } } return getClasspathFromPackages(packageURIs); }