org.apache.myfaces.util
public class ClassUtils extends Object
Version: $Revision: 265527 $ $Date: 2005-08-31 18:32:30 +0200 (Wed, 31 Aug 2005) $
Field Summary | |
---|---|
static Class | BOOLEAN_ARRAY_CLASS |
static Class | BOOLEAN_OBJECT_ARRAY_CLASS |
static Class | BYTE_ARRAY_CLASS |
static Class | BYTE_OBJECT_ARRAY_CLASS |
static Class | CHARACTER_OBJECT_ARRAY_CLASS |
static Class | CHAR_ARRAY_CLASS |
static Map | COMMON_TYPES |
static Class | DOUBLE_ARRAY_CLASS |
static Class | DOUBLE_OBJECT_ARRAY_CLASS |
static Class | FLOAT_ARRAY_CLASS |
static Class | FLOAT_OBJECT_ARRAY_CLASS |
static Class | INTEGER_OBJECT_ARRAY_CLASS |
static Class | INT_ARRAY_CLASS |
static Class | LONG_ARRAY_CLASS |
static Class | LONG_OBJECT_ARRAY_CLASS |
static Class | OBJECT_ARRAY_CLASS |
static Class | SHORT_ARRAY_CLASS |
static Class | SHORT_OBJECT_ARRAY_CLASS |
static Class | STRING_OBJECT_ARRAY_CLASS |
Method Summary | |
---|---|
static Class | classForName(String type)
Tries a Class.forName with the context class loader of the current thread first and
automatically falls back to the ClassUtils class loader (i.e. the loader of the
myfaces.jar lib) if necessary.
|
static Object | convertToType(Object value, Class desiredClass) |
protected static ClassLoader | getCurrentLoader(Object defaultObject)
Gets the ClassLoader associated with the current thread. |
static InputStream | getResourceAsStream(String resource) |
static Iterator | getResources(String resource, Object defaultObject) |
static Class | javaTypeToClass(String type)
Similar as classForName, but also supports primitive types
and arrays as specified for the JavaType element in the JavaServer Faces Config DTD.
|
static Object | newInstance(String type) |
static Object | newInstance(Class clazz) |
static Class | simpleClassForName(String type)
Same as classForName, but throws a RuntimeException
(FacesException) instead of a ClassNotFoundException.
|
static Class | simpleJavaTypeToClass(String type)
Same as javaTypeToClass, but throws a RuntimeException
(FacesException) instead of a ClassNotFoundException.
|
Parameters: type fully qualified name of a non-primitive non-array class
Returns: the corresponding Class
Throws: NullPointerException if type is null ClassNotFoundException
Parameters: defaultObject The default object to use to determine the class loader (if none associated with current thread.)
Returns: ClassLoader
Parameters: resource Name of resource(s) to find in classpath defaultObject The default object to use to determine the class loader (if none associated with current thread.)
Returns: Iterator over URL Objects
Parameters: type fully qualified class name or name of a primitive type, both optionally followed by "[]" to indicate an array type
Returns: the corresponding Class
Throws: NullPointerException if type is null ClassNotFoundException
Returns: the corresponding Class
Throws: NullPointerException if type is null FacesException if class not found
Returns: the corresponding Class
Throws: NullPointerException if type is null FacesException if class not found