org.apache.camel.util
Class ReflectionHelper

java.lang.Object
  extended by org.apache.camel.util.ReflectionHelper

public final class ReflectionHelper
extends Object

Helper for working with reflection on classes.

This code is based on org.apache.camel.spring.util.ReflectionUtils class.


Nested Class Summary
static interface ReflectionHelper.FieldCallback
          Callback interface invoked on each field in the hierarchy.
static interface ReflectionHelper.MethodCallback
          Action to take on each method.
 
Method Summary
static void doWithFields(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(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 void setField(Field f, Object instance, Object value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

doWithFields

public static void doWithFields(Class<?> clazz,
                                ReflectionHelper.FieldCallback fc)
                         throws IllegalArgumentException
Invoke the given callback on all fields in the target class, going up the class hierarchy to get all declared fields.

Parameters:
clazz - the target class to analyze
fc - the callback to invoke for each field
Throws:
IllegalArgumentException

doWithMethods

public static void doWithMethods(Class<?> clazz,
                                 ReflectionHelper.MethodCallback mc)
                          throws IllegalArgumentException
Perform the given callback operation on all matching methods of the given class and superclasses (or given interface and super-interfaces).

Parameters:
clazz - class to start looking at
mc - the callback to invoke for each method
Throws:
IllegalArgumentException

setField

public static void setField(Field f,
                            Object instance,
                            Object value)


Apache CAMEL