public class ReflectionUtils
extends java.lang.Object
| Constructor and Description |
|---|
ReflectionUtils() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
getClassName(java.lang.Object object)
Get the class name of the provided object
|
static java.util.HashMap<java.lang.String,java.lang.reflect.Method> |
getGetterMethods(java.lang.Class<?> c) |
static java.lang.reflect.Method |
getMethod(java.lang.Class<?> c,
java.lang.String methodName)
Loop through all declared methods and find the method that matches
the methodName (if it exists)
|
static java.lang.String[] |
getMethodNamesFromMethods(java.lang.reflect.Method[] methods)
Retrieve a list of method names with their get and set prefix removed
|
static java.util.HashMap<java.lang.String,java.lang.reflect.Method> |
getSetterMethods(java.lang.Class<?> c) |
static <T> java.lang.Object |
invokeMethod(java.lang.Object object,
java.lang.reflect.Method method)
invoke reflection method for a response
|
static void |
invokeMethod(java.lang.Object object,
java.lang.reflect.Method method,
byte[] byteValue)
invoke reflection method
|
static void |
invokeMethod(java.lang.Object object,
java.lang.reflect.Method method,
float floatValue)
invoke reflection method
|
static void |
invokeMethod(java.lang.Object object,
java.lang.reflect.Method method,
int intValue)
invoke reflection method
|
static void |
invokeMethod(java.lang.Object object,
java.lang.reflect.Method method,
long longValue)
invoke reflection method
|
static <T> void |
invokeMethod(java.lang.Object object,
java.lang.reflect.Method method,
T value)
invoke reflection method
|
static java.lang.Object |
newInstance(java.lang.Class<?> c)
Create a new object instance based on the class provided
|
public static java.lang.Object newInstance(java.lang.Class<?> c)
c - Create a new object instance based on this classpublic static java.lang.reflect.Method getMethod(java.lang.Class<?> c,
java.lang.String methodName)
c - The class to get the declared methods frommethodName - The methodName that the declared method should be returned forpublic static java.util.HashMap<java.lang.String,java.lang.reflect.Method> getGetterMethods(java.lang.Class<?> c)
public static java.util.HashMap<java.lang.String,java.lang.reflect.Method> getSetterMethods(java.lang.Class<?> c)
public static java.lang.String getClassName(java.lang.Object object)
object - The object to get the class name forpublic static java.lang.String[] getMethodNamesFromMethods(java.lang.reflect.Method[] methods)
methods - The methods to create the names forpublic static void invokeMethod(java.lang.Object object,
java.lang.reflect.Method method,
byte[] byteValue)
object - The object to invoke the method onmethod - The method to invokebyteValue - The value to pass into the methodpublic static void invokeMethod(java.lang.Object object,
java.lang.reflect.Method method,
float floatValue)
object - The object to invoke the method onmethod - The method to invokefloatValue - The value to pass into the methodpublic static void invokeMethod(java.lang.Object object,
java.lang.reflect.Method method,
long longValue)
object - The object to invoke the method onmethod - The method to invokelongValue - The value to pass into the methodpublic static void invokeMethod(java.lang.Object object,
java.lang.reflect.Method method,
int intValue)
object - The object to invoke the method onmethod - The method to invokeintValue - The value to pass into the methodpublic static <T> void invokeMethod(java.lang.Object object,
java.lang.reflect.Method method,
T value)
T - object - The object to invoke the method onmethod - The method to invokevalue - The value to pass into the methodpublic static <T> java.lang.Object invokeMethod(java.lang.Object object,
java.lang.reflect.Method method)
object - The object to invoke the method onmethod - The method to invoke