edu.harvard.seas.iis.util
Class ReflectionUtils
java.lang.Object
edu.harvard.seas.iis.util.ReflectionUtils
public class ReflectionUtils
- extends Object
Method Summary |
static Class[] |
getInterfaces(Class c)
Returns all interfaces implemented by a given class or its parents |
static Object |
getStaticFieldValueForClass(String fieldName,
Class c,
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) |
ReflectionUtils
public ReflectionUtils()
getStaticFieldValueForClass
public static Object getStaticFieldValueForClass(String fieldName,
Class c,
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 Class[] getInterfaces(Class c)
- Returns all interfaces implemented by a given class or its parents
- Parameters:
c
-
- Returns:
- an array of interfaces