Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jboss.errai.reflections.util
Class ClasspathHelper

    java.lang.Object
      org.jboss.errai.reflections.util.ClasspathHelper

    public abstract class ClasspathHelper

extends java.lang.Object

Some classpath convenient methods

Field Summary
`static java.lang.ClassLoader[]` | `defaultClassLoaders`

Constructor Summary
`ClasspathHelper()`

Method Summary
`static java.lang.ClassLoader[]` | `classLoaders(java.lang.ClassLoader... classLoaders)` returns given classLoaders, if not null, otherwise defaults to both `getContextClassLoader()` and `getStaticClassLoader()`
`static java.net.URL` | `forClass(java.lang.Class<?> aClass, java.lang.ClassLoader... classLoaders)` returns the url that contains the given class, using `ClassLoader.getResource(String)`
`static java.util.Set<java.net.URL>` | `forClassLoader(java.lang.ClassLoader... classLoaders)` returns urls using `URLClassLoader.getURLs()` up the classloader parent hierarchy
`static java.util.Set<java.net.URL>` | `forJavaClassPath()` returns urls using `java.class.path` system property
`static java.util.Set<java.net.URL>` | `forManifest()` return urls that are in the current class path.
`static java.util.Set<java.net.URL>` | `forManifest(java.lang.Iterable<java.net.URL> urls)` get the urls that are specified in the manifest of the given urls.
`static java.util.Set<java.net.URL>` | `forManifest(java.net.URL url)` get the urls that are specified in the manifest of the given url for a jar file.
`static java.util.Set<java.net.URL>` | `forPackage(java.lang.String name, java.lang.ClassLoader... classLoaders)` returns urls with resources of package starting with given name, using `ClassLoader.getResources(String)`
`static java.net.URL` | `forWebInfClasses(javax.servlet.ServletContext servletContext)` returns url using `ServletContext` in resource path WEB-INF/classes
`static java.util.Set<java.net.URL>` | `forWebInfLib(javax.servlet.ServletContext servletContext)` returns urls using `ServletContext` in resource path WEB-INF/lib
`static java.lang.ClassLoader` | `getContextClassLoader()` returns `Thread.currentThread().getContextClassLoader()`
`static java.lang.ClassLoader` | `getStaticClassLoader()` returns `Reflections.class.getClassLoader()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### defaultClassLoaders

    public static java.lang.ClassLoader[] defaultClassLoaders

Constructor Detail

### ClasspathHelper

    public ClasspathHelper()

Method Detail

### getContextClassLoader

    public static java.lang.ClassLoader getContextClassLoader()

  returns `Thread.currentThread().getContextClassLoader()`

### getStaticClassLoader

    public static java.lang.ClassLoader getStaticClassLoader()

  returns `Reflections.class.getClassLoader()`

### classLoaders

    public static java.lang.ClassLoader[] classLoaders(java.lang.ClassLoader... classLoaders)

  returns given classLoaders, if not null, otherwise defaults to both `getContextClassLoader()` and `getStaticClassLoader()`

### forPackage

    public static java.util.Set<java.net.URL> forPackage(java.lang.String name,
                                                         java.lang.ClassLoader... classLoaders)

  returns urls with resources of package starting with given name, using `ClassLoader.getResources(String)`

  that is, forPackage("org.reflections") effectively returns urls from classpath with packages starting with `org.jboss.errai.reflections`

  if optional `ClassLoader`s are not specified, then both `getContextClassLoader()` and `getStaticClassLoader()` are used for `ClassLoader.getResources(String)`

### forClass

    public static java.net.URL forClass(java.lang.Class<?> aClass,
                                        java.lang.ClassLoader... classLoaders)

  returns the url that contains the given class, using `ClassLoader.getResource(String)`

  if optional `ClassLoader`s are not specified, then either `getContextClassLoader()` or `getStaticClassLoader()` are used for `ClassLoader.getResources(String)`

### forClassLoader

    public static java.util.Set<java.net.URL> forClassLoader(java.lang.ClassLoader... classLoaders)

  returns urls using `URLClassLoader.getURLs()` up the classloader parent hierarchy

  if optional `ClassLoader`s are not specified, then both `getContextClassLoader()` and `getStaticClassLoader()` are used for `ClassLoader.getResources(String)`

### forJavaClassPath

    public static java.util.Set<java.net.URL> forJavaClassPath()

  returns urls using `java.class.path` system property

### forWebInfLib

    public static java.util.Set<java.net.URL> forWebInfLib(javax.servlet.ServletContext servletContext)

  returns urls using `ServletContext` in resource path WEB-INF/lib

### forWebInfClasses

    public static java.net.URL forWebInfClasses(javax.servlet.ServletContext servletContext)

  returns url using `ServletContext` in resource path WEB-INF/classes

### forManifest

    public static java.util.Set<java.net.URL> forManifest()

  return urls that are in the current class path. attempts to load the jar manifest, if any, and adds to the result any dependencies it finds.

### forManifest

    public static java.util.Set<java.net.URL> forManifest(java.net.URL url)

  get the urls that are specified in the manifest of the given url for a jar file. attempts to load the jar manifest, if any, and adds to the result any dependencies it finds.

### forManifest

    public static java.util.Set<java.net.URL> forManifest(java.lang.Iterable<java.net.URL> urls)

  get the urls that are specified in the manifest of the given urls. attempts to load the jar manifest, if any, and adds to the result any dependencies it finds.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2011. All Rights Reserved.