public class ReflectionHandler
extends java.lang.Object
Reflection package.| Constructor and Description |
|---|
ReflectionHandler() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.reflect.Constructor |
getConstructor(java.lang.reflect.Constructor[] constructors,
java.lang.Class[] paramTypes)
Check all constructors to see if any match the input parameters or super classes
of the input parameters.
|
static java.lang.reflect.Constructor[] |
getConstructors(java.lang.Class theClass)
Retrieve the constructors for the specified class.
|
static java.lang.reflect.Field |
getInstanceField(java.lang.Object instanceObj,
java.lang.String varName)
Get actual variable field instance if it is defined.
|
static java.lang.Object |
getInstanceVariable(java.lang.Object instanceObj,
java.lang.String varName)
Get the value of the named variable instance, if it is accessible.
|
static java.lang.reflect.Method[] |
getMethods(java.lang.Class theClass)
Retrieve a list of all public methods in the class.
|
static boolean |
hasConstructor(java.lang.String className,
java.lang.Class[] paramTypes)
Return true if a constructor with the specified parameter list exists for the class type.
|
static java.lang.reflect.Method |
retrieveMethod(java.lang.Class objClass,
java.lang.String methodName)
Try to retrieve the method from the object, matching to the method name only.
|
static java.lang.reflect.Method |
retrieveMethod(java.lang.Class objClass,
java.lang.String methodName,
java.lang.String replyClass)
Try to retrieve the method from the object.
|
static java.lang.reflect.Method |
retrieveMethod(java.lang.Class objClass,
java.lang.String methodName,
java.lang.String replyClass,
java.util.ArrayList<java.lang.String> paramTypes)
Try to retrieve the method from the object.
|
public static java.lang.reflect.Constructor[] getConstructors(java.lang.Class theClass)
theClass - the class instance.public static java.lang.reflect.Method[] getMethods(java.lang.Class theClass)
theClass - the class instance.public static java.lang.reflect.Constructor getConstructor(java.lang.reflect.Constructor[] constructors,
java.lang.Class[] paramTypes)
constructors - a list of constructors.paramTypes - the parameter type classes.public static boolean hasConstructor(java.lang.String className,
java.lang.Class[] paramTypes)
className - the name of the java class to construct.paramTypes - a list of constructor parameter types.public static java.lang.reflect.Method retrieveMethod(java.lang.Class objClass,
java.lang.String methodName)
objClass - the class for the object that executes the method.methodName - the method name.public static java.lang.reflect.Method retrieveMethod(java.lang.Class objClass,
java.lang.String methodName,
java.lang.String replyClass)
objClass - the class for the object that executes the method.methodName - the method name.replyClass - the reply type. This is optional.public static java.lang.reflect.Method retrieveMethod(java.lang.Class objClass,
java.lang.String methodName,
java.lang.String replyClass,
java.util.ArrayList<java.lang.String> paramTypes)
objClass - the class for the object that executes the method.methodName - the method name.replyClass - the reply type. This is optional.paramTypes - list of parameter types. Can be empty.public static java.lang.reflect.Field getInstanceField(java.lang.Object instanceObj,
java.lang.String varName)
instanceObj - the object instance to set the value on.varName - the name of the variable to set it's value.public static java.lang.Object getInstanceVariable(java.lang.Object instanceObj,
java.lang.String varName)
instanceObj - the object instance to set the value on.varName - the name of the variable to set it's value.