Methods Summary |
---|
public static boolean | classExists(java.lang.ClassLoader loader, java.lang.String className)Check if a classloader has a classname resource.
return loader.getResource(classNameToResource(className)) != null;
|
public static java.lang.String | classNameToResource(java.lang.String className)Return the resource name of a class name.
return className.replace('.", '/") + ".class";
|
public static java.io.File | getClassSource(java.lang.Class c)Find the directory or jar file the class has been loaded from.
return normalizeSource(Locator.getClassSource(c));
|
public static java.lang.ClassLoader | getContextClassLoader()JDK1.1 compatible access to set the context class loader.
Thread currentThread = Thread.currentThread();
return currentThread.getContextClassLoader();
|
public static java.io.File | getResourceSource(java.lang.ClassLoader c, java.lang.String resource)Find the directory or a give resource has been loaded from.
if (c == null) {
c = LoaderUtils.class.getClassLoader();
}
return normalizeSource(Locator.getResourceSource(c, resource));
|
public static boolean | isContextLoaderAvailable()Indicates if the context class loader methods are available
return true;
|
private static java.io.File | normalizeSource(java.io.File source)Normalize a source location
if (source != null) {
try {
source = FILE_UTILS.normalize(source.getAbsolutePath());
} catch (BuildException e) {
// relative path
}
}
return source;
|
public static void | setContextClassLoader(java.lang.ClassLoader loader)Set the context classloader
Thread currentThread = Thread.currentThread();
currentThread.setContextClassLoader(loader);
|