|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectus.ihmc.utilities.reflect.ReflectionTools
public final class ReflectionTools
Method Summary | ||
---|---|---|
static
|
compareAllPrimitives(T instance1,
T instance2)
Compares all primitives of two instances of a class |
|
static
|
compareDeclaredPrimitives(java.lang.Class<? extends T> cls,
T instance1,
T instance2)
Compares the declared primitives of two instances of a class |
|
static java.util.ArrayList<java.lang.reflect.Field> |
getAllFields(java.lang.Class<?> cls)
|
|
static
|
getFieldContentsAssignableFromClass(java.lang.Object object,
java.lang.Class<T> clazz)
|
|
static java.lang.String |
getStringRepresentationOfArrayEntry(java.lang.Object array,
int index)
|
|
static java.lang.String |
getStringRepresentationOfFieldContent(java.lang.Object object,
java.lang.reflect.Field field)
|
|
static
|
isPrimitiveArrayEntryTheSame(T instance1,
T instance2,
int index)
Compares the values of a field for two instances of a class. |
|
static
|
isPrimitiveFieldContentTheSame(T instance1,
T instance2,
java.lang.reflect.Field field)
Compares the values of a field for two instances of a class. |
|
static void |
printAllFieldContents(java.lang.Object instance)
Prints the contents of all fields of the instance |
|
static
|
printDeclaredFieldContents(java.lang.Class<? extends T> cls,
T instance)
Prints the contents of the declared fields of the instance. |
|
static void |
printDeclaredFields(java.lang.Class<?> cls)
Prints the declared fields of the class. |
|
static void |
printFieldContents(java.lang.Object instance,
java.lang.reflect.Field field)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static void printDeclaredFields(java.lang.Class<?> cls)
cls
- class to print the fields forpublic static <T> void printDeclaredFieldContents(java.lang.Class<? extends T> cls, T instance) throws java.lang.IllegalArgumentException, java.lang.IllegalAccessException
T
- type of the instancecls
- type to print the declared fields forinstance
- instance to print the declared field contents for
java.lang.IllegalAccessException
java.lang.IllegalArgumentException
public static void printAllFieldContents(java.lang.Object instance) throws java.lang.IllegalArgumentException, java.lang.IllegalAccessException
instance
- instance instance to print the field contents for
java.lang.IllegalAccessException
java.lang.IllegalArgumentException
public static <T> java.util.ArrayList<java.lang.reflect.Field> compareDeclaredPrimitives(java.lang.Class<? extends T> cls, T instance1, T instance2) throws java.lang.IllegalArgumentException, java.lang.IllegalAccessException
T
- type of the instancescls
- type to compare the declared fields forinstance1
- first instance to testinstance2
- second instance to test
java.lang.IllegalAccessException
java.lang.IllegalArgumentException
public static <T> java.util.ArrayList<java.lang.reflect.Field> compareAllPrimitives(T instance1, T instance2) throws java.lang.IllegalArgumentException, java.lang.IllegalAccessException
T
- type of the instancesinstance1
- first instance to testinstance2
- second instance to test
java.lang.IllegalAccessException
java.lang.IllegalArgumentException
public static <T> boolean isPrimitiveFieldContentTheSame(T instance1, T instance2, java.lang.reflect.Field field) throws java.lang.IllegalArgumentException, java.lang.IllegalAccessException
T
- type of the instances. Type must contain the specified field.instance1
- first instance to testinstance2
- second instance to testfield
- field to test
java.lang.IllegalAccessException
java.lang.IllegalArgumentException
public static <T> boolean isPrimitiveArrayEntryTheSame(T instance1, T instance2, int index)
T
- type of the instances. Type must contain the specified field.instance1
- first instance to testinstance2
- second instance to testfield
- field to test
public static java.lang.String getStringRepresentationOfFieldContent(java.lang.Object object, java.lang.reflect.Field field) throws java.lang.IllegalArgumentException, java.lang.IllegalAccessException
java.lang.IllegalArgumentException
java.lang.IllegalAccessException
public static java.lang.String getStringRepresentationOfArrayEntry(java.lang.Object array, int index)
public static java.util.ArrayList<java.lang.reflect.Field> getAllFields(java.lang.Class<?> cls)
public static void printFieldContents(java.lang.Object instance, java.lang.reflect.Field field) throws java.lang.IllegalArgumentException, java.lang.IllegalAccessException
java.lang.IllegalArgumentException
java.lang.IllegalAccessException
public static <T> java.util.List<T> getFieldContentsAssignableFromClass(java.lang.Object object, java.lang.Class<T> clazz)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |