public class ReflectionUtils
extends java.lang.Object
Constructor and Description |
---|
ReflectionUtils() |
Modifier and Type | Method and Description |
---|---|
static double |
asDouble(java.lang.Object o) |
static <T> java.lang.Class<T> |
findActualClassParameter(java.lang.Class clz,
int parm)
Reflection helper which returns the actual class for a type parameter, even if itself is parameterized.
|
static java.lang.Class |
findActualFieldClass(java.lang.Class clz,
java.lang.reflect.Field f)
Reflection helper which returns the actual class for a field which has a parameterized type.
|
static java.lang.Class |
findMethodOutputClass(java.lang.reflect.Method method)
Reflection helper which returns the actual class for a method's parameter.
|
static java.lang.Class |
findMethodParameterClass(java.lang.reflect.Method method,
int parm)
Reflection helper which returns the actual class for a method's parameter.
|
static java.lang.reflect.Field |
findNamedField(java.lang.Object o,
java.lang.String field_name)
Return the Field for the specified name.
|
static <T> T |
getFieldValue(java.lang.Object o,
java.lang.String fieldName) |
public static <T> java.lang.Class<T> findActualClassParameter(java.lang.Class clz, int parm)
public static java.lang.Class findMethodParameterClass(java.lang.reflect.Method method, int parm)
public static java.lang.Class findMethodOutputClass(java.lang.reflect.Method method)
public static java.lang.Class findActualFieldClass(java.lang.Class clz, java.lang.reflect.Field f)
public static double asDouble(java.lang.Object o)
public static java.lang.reflect.Field findNamedField(java.lang.Object o, java.lang.String field_name)
Java reflection will either give you all the public fields all the way up the class hierarchy (getField()), or will give you all the private/protected/public only in the single class (getDeclaredField()). This method uses the latter but walks up the class hierarchy.
public static <T> T getFieldValue(java.lang.Object o, java.lang.String fieldName)