public final class ClassUtils
extends java.lang.Object
| Constructor and Description |
|---|
ClassUtils() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.ClassLoader |
createClassLoader(java.lang.String classpath,
java.lang.ClassLoader parent)
Creates a new ClassLoader from a classpath specification and a parent
class loader.
|
static java.lang.Class |
forName(java.lang.String className)
Use this method instead of Class.forName
|
static java.lang.Class |
forName(java.lang.String _className,
boolean init,
java.lang.ClassLoader _loader)
Use this method instead of Class.forName (String className, boolean init, ClassLoader loader)
|
static java.lang.ClassLoader |
getClassLoader(java.lang.String className)
Obtain the ClassLoader (if any) associated with the given
className.
|
static java.lang.ClassLoader |
getDefaultClassLoader() |
static java.io.InputStream |
getResourceAsStream(java.lang.Class clazz,
java.lang.String resource)
Get an input stream from a named resource.
|
static java.io.InputStream |
getResourceAsStream(java.lang.Class clazz,
java.lang.String resource,
boolean checkThreadContextFirst)
Get an input stream from a named resource.
|
static void |
removeClassLoader(java.lang.String className)
Deregister the ClassLoader for a given className.
|
static void |
setClassLoader(java.lang.String className,
java.lang.ClassLoader loader)
Set the ClassLoader associated with the given className.
|
static void |
setDefaultClassLoader(java.lang.ClassLoader loader)
Set the default ClassLoader.
|
public static void setDefaultClassLoader(java.lang.ClassLoader loader)
loader - the new default ClassLoaderpublic static java.lang.ClassLoader getDefaultClassLoader()
public static void setClassLoader(java.lang.String className,
java.lang.ClassLoader loader)
className - the name of a classloader - the ClassLoader for the classpublic static java.lang.ClassLoader getClassLoader(java.lang.String className)
className - the name of a classpublic static void removeClassLoader(java.lang.String className)
className - the name of a classpublic static java.lang.Class forName(java.lang.String className)
throws java.lang.ClassNotFoundException
className - Class namejava.lang.ClassNotFoundException - if the class is not foundpublic static java.lang.Class forName(java.lang.String _className,
boolean init,
java.lang.ClassLoader _loader)
throws java.lang.ClassNotFoundException
_className - Class nameinit - initialize the class_loader - class loaderjava.lang.ClassNotFoundException - if the class is not foundpublic static java.io.InputStream getResourceAsStream(java.lang.Class clazz,
java.lang.String resource,
boolean checkThreadContextFirst)
clazz - class to use in the lookupsresource - resource string to look forcheckThreadContextFirst - check the thread context first?public static java.io.InputStream getResourceAsStream(java.lang.Class clazz,
java.lang.String resource)
clazz - class to use in the lookupsresource - resource string to look forpublic static java.lang.ClassLoader createClassLoader(java.lang.String classpath,
java.lang.ClassLoader parent)
throws java.lang.SecurityException
classpath - the classpath Stringparent - the parent ClassLoader, or null if the default is to be
usedjava.lang.SecurityException - if you don't have privilages to create
class loadersjava.lang.IllegalArgumentException - if your classpath string is sillyCopyright ? 2005 Apache Web Services Project. All Rights Reserved.