|
JIDE 3.5.15 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.jidesoft.utils.ReflectionUtils
public class ReflectionUtils
Utility class to use reflection to call methods.
| Constructor Summary | |
|---|---|
ReflectionUtils()
|
|
| Method Summary | |
|---|---|
static void |
call(Object thisObject,
String methodName)
Helper method to call a no argument, no return method. |
static Object |
callAny(Object thisObject,
String methodName,
Class<?>[] argTypes,
Object[] args)
Helper method to call a multi-argument method having a return. |
static Object |
callAny(Object thisObject,
String methodName,
Object[] args)
Helper method to call a multi-argument method having a return. |
static Object |
callAnyWithoutException(Object thisObject,
Class<?> objectClass,
String methodName,
Class<?>[] argTypes,
Object[] args)
Helper method to call a multi-argument method having a return without throwing an exception. |
static Object |
callConstructor(Class<?> clazz,
Class<?>[] argTypes,
Object[] args)
Helper method to call a constructor. |
static Object |
callGet(Object thisObject,
String methodName)
Helper method to call a get method with no argument. |
static void |
callSet(Object thisObject,
String methodName,
Object value)
Helper method to call a set boolean method. |
static void |
callSetBoolean(Object thisObject,
String methodName,
boolean value)
Helper method to call a set boolean method. |
static void |
callSetInt(Object thisObject,
String methodName,
int value)
Helper method to call a set boolean method. |
static Object |
callStatic(Class<?> thisClass,
String methodName,
Class<?>[] argTypes,
Object[] args)
Helper method to call a multi-argument static class method having a return. |
static Object |
createInstance(String className,
Class<?>[] types,
Object[] args)
Instantiate an object based on the class name. |
static boolean |
isSubClassOf(Object o,
String className)
Checks if the instance o is an instance of a subclass of the designated class name. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ReflectionUtils()
| Method Detail |
|---|
public static void callSetBoolean(Object thisObject,
String methodName,
boolean value)
throws Exception
thisObject - the instancemethodName - the method namevalue - true or false
Exception - if the method is not found or invocation to the method fails.
public static void callSetInt(Object thisObject,
String methodName,
int value)
throws Exception
thisObject - the instancemethodName - the method namevalue - the value
Exception - if the method is not found or invocation to the method fails.
public static void callSet(Object thisObject,
String methodName,
Object value)
throws Exception
thisObject - the instancemethodName - the method namevalue - the value
Exception - if the method is not found or invocation to the method fails.
public static Object callGet(Object thisObject,
String methodName)
throws Exception
thisObject - the instancemethodName - the method name
Exception - if the method is not found or invocation to the method fails.
public static void call(Object thisObject,
String methodName)
throws Exception
thisObject - the instancemethodName - the method name
Exception - if the method is not found or invocation to the method fails.
public static Object callConstructor(Class<?> clazz,
Class<?>[] argTypes,
Object[] args)
throws Exception
clazz - the classargTypes - argument Classes for constructor lookup. Must not be null.args - the argument array
Exception - if the method is not found or invocation to the method fails.
public static Object callAny(Object thisObject,
String methodName,
Object[] args)
throws Exception
callAny(Object, methodName, argTypes, args).
thisObject - the instancemethodName - the method nameargs - the argument array, must not contain null.
Exception - if the method is not found or invocation to the method fails.
public static Object callAny(Object thisObject,
String methodName,
Class<?>[] argTypes,
Object[] args)
throws Exception
thisObject - the instancemethodName - the method nameargTypes - argument Classes for constructor lookup. Must not be null.args - the argument array
Exception - if the method is not found or invocation to the method fails.
public static Object callAnyWithoutException(Object thisObject,
Class<?> objectClass,
String methodName,
Class<?>[] argTypes,
Object[] args)
thisObject - the instanceobjectClass - the class which could find the method namemethodName - the method nameargTypes - argument Classes for constructor lookup. Must not be null.args - the argument array
public static Object callStatic(Class<?> thisClass,
String methodName,
Class<?>[] argTypes,
Object[] args)
throws Exception
thisClass - the classmethodName - the method nameargTypes - argument Classes for constructor lookup. Must not be null.args - the argument array
Exception - if the method is not found or invocation to the method fails.
public static Object createInstance(String className,
Class<?>[] types,
Object[] args)
className - the class nametypes - the class types for the constructorargs - the constructor values
public static boolean isSubClassOf(Object o,
String className)
o - the instance to checkclassName - the class name to check
|
JIDE 3.5.15 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||