public final class ClassUtils extends Object
| Constructor and Description |
|---|
ClassUtils() |
| Modifier and Type | Method and Description |
|---|---|
static ClassLoader |
createClassLoader(String classpath,
ClassLoader parent)
Creates a new ClassLoader from a classpath specification and a parent
class loader.
|
static Class |
forName(String className)
Use this method instead of Class.forName
|
static Class |
forName(String _className,
boolean init,
ClassLoader _loader)
Use this method instead of Class.forName (String className, boolean init, ClassLoader loader)
|
static ClassLoader |
getDefaultClassLoader() |
static InputStream |
getResourceAsStream(Class clazz,
String resource)
Get an input stream from a named resource.
|
static InputStream |
getResourceAsStream(String resource,
ClassLoader fallbackClassLoader)
Get an input stream from a named resource.
|
static void |
setDefaultClassLoader(ClassLoader loader)
Set the default ClassLoader.
|
public static void setDefaultClassLoader(ClassLoader loader)
loader - the new default ClassLoaderpublic static ClassLoader getDefaultClassLoader()
public static Class forName(String className) throws ClassNotFoundException
className - Class nameClassNotFoundException - if the class is not foundpublic static Class forName(String _className, boolean init, ClassLoader _loader) throws ClassNotFoundException
_className - Class nameinit - initialize the class_loader - class loaderClassNotFoundException - if the class is not foundpublic static InputStream getResourceAsStream(String resource, ClassLoader fallbackClassLoader)
resource - resource string to look forfallbackClassLoader - the class loader to use if the resource could not be loaded from
the thread context class loaderpublic static InputStream getResourceAsStream(Class clazz, String resource)
clazz - class to use in the lookupsresource - resource string to look forpublic static ClassLoader createClassLoader(String classpath, ClassLoader parent) throws SecurityException
classpath - the classpath Stringparent - the parent ClassLoader, or null if the default is to be
usedSecurityException - if you don't have privilages to create
class loadersIllegalArgumentException - if your classpath string is sillyCopyright © The Apache Software Foundation. All Rights Reserved.