|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectecologylab.generic.Debug
ecologylab.generic.ReflectionTools
public class ReflectionTools
Utility routines for working with reflection.
| Field Summary | |
|---|---|
static java.lang.Object |
BAD_ACCESS
|
| Constructor Summary | |
|---|---|
ReflectionTools()
|
|
| Method Summary | ||
|---|---|---|
static java.lang.reflect.Field |
getDeclaredField(java.lang.Class thatClass,
java.lang.String fieldName)
Get the Field object with name fieldName, in thatClass. |
|
static java.lang.reflect.Field |
getField(java.lang.Class thatClass,
java.lang.String fieldName)
Get the Field object with name fieldName, in thatClass. |
|
static java.lang.Object |
getFieldValue(java.lang.Object that,
java.lang.reflect.Field field)
Return the value of the Field in the Object, or BAD_ACCESS if it can't be accessed. |
|
static
|
getInstance(java.lang.Class<T> thatClass)
Wraps the no argument getInstance() method. |
|
static
|
getInstance(java.lang.Class<T> thatClass,
java.lang.Class[] parameterTypes,
java.lang.Object[] args)
Wraps the no argument getInstance() method. |
|
static java.lang.reflect.Method |
getMethod(java.lang.Class context,
java.lang.String name,
java.lang.Class[] types)
Find a Method object if there is one in the context class, or return null if not. |
|
static java.lang.reflect.Type[] |
getParameterizedTypeTokens(java.lang.reflect.Field field)
Get the parameterized type tokens that the generic Field was declared with. |
|
static boolean |
isAnnotationPresent(java.lang.reflect.Field field,
java.lang.Class annotationClass)
See if the Field has the annotation in its declaration. |
|
static boolean |
setFieldValue(java.lang.Object that,
java.lang.reflect.Field field,
java.lang.Object value)
Set a reference type Field to a value. |
|
| Methods inherited from class ecologylab.generic.Debug |
|---|
classSimpleName, closeLoggingFile, debug, debug, debug, debug, debugA, debugA, debugA, debugI, debugI, debugI, error, error, getClassName, getClassName, getInteractive, getPackageName, getPackageName, getPackageName, initialize, level, level, level, logToFile, print, print, println, println, println, println, println, println, printlnA, printlnA, printlnA, printlnI, printlnI, printlnI, printlnI, setLoggingFile, show, show, superString, toggleInteractive, toString, toString, warning, warning, weird, weird |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.Object BAD_ACCESS
| Constructor Detail |
|---|
public ReflectionTools()
| Method Detail |
|---|
public static java.lang.reflect.Field getField(java.lang.Class thatClass,
java.lang.String fieldName)
thatClass - fieldName -
public static java.lang.reflect.Field getDeclaredField(java.lang.Class thatClass,
java.lang.String fieldName)
thatClass - fieldName -
public static java.lang.Object getFieldValue(java.lang.Object that,
java.lang.reflect.Field field)
that - field -
public static boolean setFieldValue(java.lang.Object that,
java.lang.reflect.Field field,
java.lang.Object value)
that - Object that the field is in.field - Reference type field within that object.value - Value to set the reference field to.
public static <T> T getInstance(java.lang.Class<T> thatClass)
thatClass -
public static <T> T getInstance(java.lang.Class<T> thatClass,
java.lang.Class[] parameterTypes,
java.lang.Object[] args)
thatClass -
public static java.lang.reflect.Method getMethod(java.lang.Class context,
java.lang.String name,
java.lang.Class[] types)
context - Class to find the Method in.name - Name of the method.types - Array of Class objects indicating parameter types.
public static boolean isAnnotationPresent(java.lang.reflect.Field field,
java.lang.Class annotationClass)
field - annotationClass -
public static java.lang.reflect.Type[] getParameterizedTypeTokens(java.lang.reflect.Field field)
reflectType -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||