edu.harvard.seas.iis.util
Class ReflectionUtils

java.lang.Object
  extended by edu.harvard.seas.iis.util.ReflectionUtils

public class ReflectionUtils
extends java.lang.Object


Constructor Summary
ReflectionUtils()
           
 
Method Summary
static java.lang.Class[] getInterfaces(java.lang.Class c)
          Returns all interfaces implemented by a given class or its parents
static java.lang.Object getStaticFieldValueForClass(java.lang.String fieldName, java.lang.Class c, java.lang.Object defaultValue)
          Returns the value of the static field of a given name from a given class; if the field is not defined in that class, the method will inspect all of the ancestors of the class (though not interfaces)
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReflectionUtils

public ReflectionUtils()
Method Detail

getStaticFieldValueForClass

public static java.lang.Object getStaticFieldValueForClass(java.lang.String fieldName,
                                                           java.lang.Class c,
                                                           java.lang.Object defaultValue)
Returns the value of the static field of a given name from a given class; if the field is not defined in that class, the method will inspect all of the ancestors of the class (though not interfaces)

Parameters:
fieldName -
c -
defaultValue - the value to be returned if actual value cannot be retrieved for some reason
Returns:
value of the field or defaultValue if there is any problem (security exception, the field is not declared in the class or any of it ancestors, etc)

getInterfaces

public static java.lang.Class[] getInterfaces(java.lang.Class c)
Returns all interfaces implemented by a given class or its parents

Parameters:
c -
Returns:
an array of interfaces