public class LoaderUtils extends Object
Constructor and Description |
---|
LoaderUtils() |
Modifier and Type | Method and Description |
---|---|
static boolean |
classExists(java.lang.ClassLoader loader,
String className)
Check if a classloader has a classname resource.
|
static String |
classNameToResource(String className)
Return the resource name of a class name.
|
static File |
getClassSource(Class c)
Find the directory or jar file the class has been loaded from.
|
static java.lang.ClassLoader |
getContextClassLoader()
JDK1.1 compatible access to set the context class loader.
|
static File |
getResourceSource(java.lang.ClassLoader c,
String resource)
Find the directory or a give resource has been loaded from.
|
static boolean |
isContextLoaderAvailable()
Indicates if the context class loader methods are available
|
static void |
setContextClassLoader(java.lang.ClassLoader loader)
Set the context classloader
|
public static boolean classExists(java.lang.ClassLoader loader, String className)
loader
- the classloader to look it.className
- the name of the class to look for.public static String classNameToResource(String className)
className
- the name of the class to convert.public static File getClassSource(Class c)
c
- the class whose location is required.public static java.lang.ClassLoader getContextClassLoader()
public static File getResourceSource(java.lang.ClassLoader c, String resource)
c
- the classloader to be consulted for the sourceresource
- the resource whose location is required.public static boolean isContextLoaderAvailable()
public static void setContextClassLoader(java.lang.ClassLoader loader)
loader
- the ClassLoader to be used as the context class loader
on the current thread.