public final class ReflectionHelper
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
ReflectionHelper.FieldCallback
Callback interface invoked on each field in the hierarchy.
|
static interface |
ReflectionHelper.MethodCallback
Action to take on each method.
|
Modifier and Type | Method and Description |
---|---|
static void |
doWithFields(java.lang.Class<?> clazz,
ReflectionHelper.FieldCallback fc)
Invoke the given callback on all fields in the target class, going up the
class hierarchy to get all declared fields.
|
static void |
doWithMethods(java.lang.Class<?> clazz,
ReflectionHelper.MethodCallback mc)
Perform the given callback operation on all matching methods of the given
class and superclasses (or given interface and super-interfaces).
|
static java.lang.Object |
getField(java.lang.reflect.Field f,
java.lang.Object instance) |
static void |
setField(java.lang.reflect.Field f,
java.lang.Object instance,
java.lang.Object value) |
public static void doWithFields(java.lang.Class<?> clazz, ReflectionHelper.FieldCallback fc) throws java.lang.IllegalArgumentException
clazz
- the target class to analyzefc
- the callback to invoke for each fieldjava.lang.IllegalArgumentException
public static void doWithMethods(java.lang.Class<?> clazz, ReflectionHelper.MethodCallback mc) throws java.lang.IllegalArgumentException
clazz
- class to start looking atmc
- the callback to invoke for each methodjava.lang.IllegalArgumentException
public static java.lang.Object getField(java.lang.reflect.Field f, java.lang.Object instance)
public static void setField(java.lang.reflect.Field f, java.lang.Object instance, java.lang.Object value)
Copyright © 2016 Red Hat. All Rights Reserved.