|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.reflections.util.ClasspathHelper
public abstract class ClasspathHelper
Some classpath convenient methods
| Constructor Summary | |
|---|---|
ClasspathHelper()
|
|
| Method Summary | |
|---|---|
static ClassLoader[] |
classLoaders(ClassLoader... classLoaders)
returns given classLoaders, if not null, otherwise defaults to both contextClassLoader() and staticClassLoader() |
static String |
cleanPath(URL url)
|
static ClassLoader |
contextClassLoader()
returns Thread.currentThread().getContextClassLoader() |
static URL |
forClass(Class<?> aClass,
ClassLoader... classLoaders)
returns the url that contains the given class, using ClassLoader.getResource(String) |
static Set<URL> |
forClassLoader()
returns urls using URLClassLoader.getURLs() up the default classloaders parent hierarchy |
static Set<URL> |
forClassLoader(ClassLoader... classLoaders)
returns urls using URLClassLoader.getURLs() up the classloader parent hierarchy |
static Set<URL> |
forJavaClassPath()
returns urls using java.class.path system property |
static Set<URL> |
forManifest()
return urls that are in the current class path. |
static Set<URL> |
forManifest(Iterable<URL> urls)
get the urls that are specified in the manifest of the given urls. |
static Set<URL> |
forManifest(URL url)
get the urls that are specified in the manifest of the given url for a jar file. |
static Set<URL> |
forPackage(String name,
ClassLoader... classLoaders)
returns urls with resources of package starting with given name, using ClassLoader.getResources(String) |
static Set<URL> |
forResource(String resourceName,
ClassLoader... classLoaders)
returns urls with resources of given @{code resourceName}, using ClassLoader.getResources(String) |
static URL |
forWebInfClasses(javax.servlet.ServletContext servletContext)
returns url using ServletContext in resource path WEB-INF/classes |
static Set<URL> |
forWebInfLib(javax.servlet.ServletContext servletContext)
returns urls using ServletContext in resource path WEB-INF/lib |
static ClassLoader |
staticClassLoader()
returns Reflections.class.getClassLoader() |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ClasspathHelper()
| Method Detail |
|---|
public static ClassLoader contextClassLoader()
Thread.currentThread().getContextClassLoader()
public static ClassLoader staticClassLoader()
Reflections.class.getClassLoader()
public static ClassLoader[] classLoaders(ClassLoader... classLoaders)
contextClassLoader() and staticClassLoader()
public static Set<URL> forPackage(String name,
ClassLoader... classLoaders)
ClassLoader.getResources(String)
that is, forPackage("org.reflections") effectively returns urls from classpath with packages starting with org.reflections
if optional ClassLoaders are not specified, then both contextClassLoader() and staticClassLoader() are used for ClassLoader.getResources(String)
public static Set<URL> forResource(String resourceName,
ClassLoader... classLoaders)
ClassLoader.getResources(String)
public static URL forClass(Class<?> aClass,
ClassLoader... classLoaders)
ClassLoader.getResource(String)
if optional ClassLoaders are not specified, then either contextClassLoader() or staticClassLoader() are used for ClassLoader.getResources(String)
public static Set<URL> forClassLoader()
URLClassLoader.getURLs() up the default classloaders parent hierarchy
using classLoaders(ClassLoader...) to get default classloaders
public static Set<URL> forClassLoader(ClassLoader... classLoaders)
URLClassLoader.getURLs() up the classloader parent hierarchy
if optional ClassLoaders are not specified, then both contextClassLoader() and staticClassLoader() are used for ClassLoader.getResources(String)
public static Set<URL> forJavaClassPath()
java.class.path system property
public static Set<URL> forWebInfLib(javax.servlet.ServletContext servletContext)
ServletContext in resource path WEB-INF/lib
public static URL forWebInfClasses(javax.servlet.ServletContext servletContext)
ServletContext in resource path WEB-INF/classes
public static Set<URL> forManifest()
public static Set<URL> forManifest(URL url)
public static Set<URL> forManifest(Iterable<URL> urls)
public static String cleanPath(URL url)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||