|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.faces.util.ReflectionUtils
public final class ReflectionUtils
A set of utility methods to make working with Classes and Reflection a little easier.
Nested Class Summary | |
---|---|
static class |
ReflectionUtils.ReflectionUtilsListener
A SerlvetContextListener to ensure that the ReflectionUtils
cache is intialized and cleanup when the application starts and finishes. |
Method Summary | |
---|---|
static void |
clearCache(java.lang.ClassLoader loader)
Clears the cache for the specified ClassLoader . |
static void |
initCache(java.lang.ClassLoader loader)
|
static java.lang.Class<?> |
lookupClass(java.lang.String className)
Obtain a Class instance based on the provided
String name. |
static java.lang.reflect.Constructor |
lookupConstructor(java.lang.Class<?> clazz,
java.lang.Class<?>... params)
Returns the Constructor appropriate to the specified
Class and parameters. |
static java.lang.reflect.Method |
lookupMethod(java.lang.Class<?> clazz,
java.lang.String methodName,
java.lang.Class<?>... params)
Returns the Method appropriate to the specified
Class, method name, and parameters. |
static java.lang.Object |
newInstance(java.lang.String className)
Constructs a new object instance based off the provided class name. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static void clearCache(java.lang.ClassLoader loader)
Clears the cache for the specified ClassLoader
.
This method MUST be called when ConfigureListener
.contextDestroyed()
is called.
loader
- the ClassLoader
whose associated cache
should be clearedpublic static void initCache(java.lang.ClassLoader loader)
public static java.lang.reflect.Constructor lookupConstructor(java.lang.Class<?> clazz, java.lang.Class<?>... params)
Returns the Constructor
appropriate to the specified
Class and parameters.
clazz
- the Class of interestparams
- the parameters for the constructor of the provided Class
public static java.lang.reflect.Method lookupMethod(java.lang.Class<?> clazz, java.lang.String methodName, java.lang.Class<?>... params)
Returns the Method
appropriate to the specified
Class, method name, and parameters.
clazz
- the Class of interestmethodName
- the name of the methodparams
- the parameters for the specified method
public static java.lang.Object newInstance(java.lang.String className) throws java.lang.InstantiationException, java.lang.IllegalAccessException
Constructs a new object instance based off the provided class name.
className
- the class of the object to instantiate
java.lang.InstantiationException
- if the class cannot be instantiated
java.lang.IllegalAccessException
- if there is a security violationpublic static java.lang.Class<?> lookupClass(java.lang.String className)
Obtain a Class
instance based on the provided
String name.
className
- the class to look up
Class
corresponding to className
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |