public class LoaderUtils
extends java.lang.Object
Constructor and Description |
---|
LoaderUtils() |
Modifier and Type | Method and Description |
---|---|
static boolean |
classExists(java.lang.ClassLoader loader,
java.lang.String className)
Check if a classloader has a classname resource.
|
static java.lang.String |
classNameToResource(java.lang.String className)
Return the resource name of a class name.
|
static java.io.File |
getClassSource(java.lang.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 java.io.File |
getResourceSource(java.lang.ClassLoader c,
java.lang.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 void setContextClassLoader(java.lang.ClassLoader loader)
loader
- the ClassLoader to be used as the context class loader
on the current thread.public static java.lang.ClassLoader getContextClassLoader()
public static boolean isContextLoaderAvailable()
public static java.io.File getClassSource(java.lang.Class c)
c
- the class whose location is required.public static java.io.File getResourceSource(java.lang.ClassLoader c, java.lang.String resource)
c
- the classloader to be consulted for the sourceresource
- the resource whose location is required.public static java.lang.String classNameToResource(java.lang.String className)
className
- the name of the class to convert.public static boolean classExists(java.lang.ClassLoader loader, java.lang.String className)
loader
- the classloader to look it.className
- the name of the class to look for.