|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.axonframework.util.ReflectionUtils
public abstract class ReflectionUtils
Utility class for working with Java Reflection API.
| Method Summary | ||
|---|---|---|
static void |
ensureAccessible(Field field)
Makes the given field accessible via reflection if it is not the case already. |
|
static Iterable<Field> |
fieldsOf(Class<?> clazz)
Returns an Iterable of all the fields declared on the given class and its super classes. |
|
static
|
findFieldValuesOfType(Object instance,
Class<T> type)
Returns a collection of values contained in the fields of the given instance that are assignable to
the given type. |
|
static Object |
getFieldValue(Field field,
Object object)
Returns the value of the given field in the given object. |
|
static boolean |
isAccessible(Field field)
Indicates whether the given field is accessible. |
|
static Iterable<Method> |
methodsOf(Class<?> clazz)
Returns an Iterable of all the methods declared on the given class and its super classes. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static <T> Collection<T> findFieldValuesOfType(Object instance,
Class<T> type)
instance that are assignable to
the given type. If the given instance contains fields with Collections or Maps, the
contents of them are investigated as well. Collections inside these collections (e.g. a List of Maps) are not
evaluated.
T - The type that the values in the fields must be assignable toinstance - The instance to search the fields intype - The type that the values in the fields must be assignable to
instance. Can be empty. Is never
null.
public static Object getFieldValue(Field field,
Object object)
field in the given object. If necessary, the field is
made accessible, assuming the security manager allows it.
field - The field containing the valueobject - The object to retrieve the field's value from
field in the object
IllegalStateException - if the field is not accessible and the security manager doesn't allow it to be made
accessiblepublic static void ensureAccessible(Field field)
field - The field to make accessible
IllegalStateException - if the field is not accessible and the security manager doesn't allow it to be made
accessiblepublic static boolean isAccessible(Field field)
field - The field to check for accessibility
true if the field is accessible, otherwise false.public static Iterable<Field> fieldsOf(Class<?> clazz)
Iterable of all the fields declared on the given class and its super classes. The iterator
will always return fields declared in a subtype before returning fields declared in a super type.
clazz - The class to return fields for
Iterable providing access to all declared fields in the class hierarchypublic static Iterable<Method> methodsOf(Class<?> clazz)
Iterable of all the methods declared on the given class and its super classes. The iterator
will always return methods declared in a subtype before returning methods declared in a super type.
clazz - The class to return methods for
Iterable providing access to all declared methods in the class hierarchy
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||