net.sourceforge.combean.util
Class ReflectionUtils

Package class diagram package ReflectionUtils
java.lang.Object
  extended by net.sourceforge.combean.util.ReflectionUtils

public final class ReflectionUtils
extends Object

Utility class containing methods for convenient use of java.lang.reflect.


Constructor Summary
ReflectionUtils()
           
 
Method Summary
static Field[] getAllFields(Class clazz)
          Retrieve all fields of a class, declared in the class itself OR in a superclass
static Field[] getAllFieldsAssignableTo(Class clazz, Class<?> pattern)
          Similar to getAllFields(Class) but returns only those fields which are assignable to pattern
static Field[] getAllFieldsMatching(Class clazz, net.sourceforge.combean.util.ReflectionUtils.FieldProperty prop)
          Similar to getAllFields(Class) but returns only those fields for which the given FieldProperty returns true
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReflectionUtils

public ReflectionUtils()
Method Detail

getAllFields

public static Field[] getAllFields(Class clazz)
Retrieve all fields of a class, declared in the class itself OR in a superclass

Parameters:
clazz - class for which all fields shall be retrieved
Returns:
the fields declared in clazz or in a superclass of clazz

getAllFieldsAssignableTo

public static Field[] getAllFieldsAssignableTo(Class clazz,
                                               Class<?> pattern)
Similar to getAllFields(Class) but returns only those fields which are assignable to pattern

Parameters:
clazz - class for which all matching fields shall be retrieved
pattern - the class to which matching fields shall be assignable
Returns:
the matching fields declared in clazz or in a superclass of clazz

getAllFieldsMatching

public static Field[] getAllFieldsMatching(Class clazz,
                                           net.sourceforge.combean.util.ReflectionUtils.FieldProperty prop)
Similar to getAllFields(Class) but returns only those fields for which the given FieldProperty returns true

Parameters:
clazz - class for which all matching fields shall be retrieved
prop - the FieldProperty which determines whether a field shall be returned or not
Returns:
the matching fields declared in clazz or in a superclass of clazz