com.iotabits.util
Class ReflectionUtil

java.lang.Object
  extended bycom.iotabits.util.ReflectionUtil

public class ReflectionUtil
extends java.lang.Object

This is a Booch package of static methods that assist with reflection-based programming.

This version is just enough to support the Reflective Visitor idiom - no more, no less.


Constructor Summary
ReflectionUtil()
           
 
Method Summary
static java.lang.reflect.Method findCovariantMethod(java.lang.Class clz, java.lang.String methodName, java.lang.Class[] paramTypes)
          We look for a method that matches name and the types of the passed in paramtypes in the given class and return it.
static java.lang.Class[] getClassInterfacesSupersAndSuperinterfaces(java.lang.Class clazz)
          Returns an array of the given class, all its superclasses, its superclass, its interfaces, etc, through Object.class.
static java.util.List getSuperclasses(java.lang.Class clazz)
          Return the list of all the superclasses of a given class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReflectionUtil

public ReflectionUtil()
Method Detail

findCovariantMethod

public static java.lang.reflect.Method findCovariantMethod(java.lang.Class clz,
                                                           java.lang.String methodName,
                                                           java.lang.Class[] paramTypes)
                                                    throws java.lang.NoSuchMethodException
We look for a method that matches name and the types of the passed in paramtypes in the given class and return it.

Parameters:
clz -
methodName -
paramTypes -
Returns:
method matching the type
Throws:
java.lang.NoSuchMethodException

getClassInterfacesSupersAndSuperinterfaces

public static java.lang.Class[] getClassInterfacesSupersAndSuperinterfaces(java.lang.Class clazz)
Returns an array of the given class, all its superclasses, its superclass, its interfaces, etc, through Object.class.

Parameters:
clazz - The starting point.
Returns:
The array of classes.

getSuperclasses

public static java.util.List getSuperclasses(java.lang.Class clazz)
Return the list of all the superclasses of a given class.

Parameters:
clazz - The class to start from.
Returns:
A read-only list of the class objects that are superclasses. The order is from most-specific to Object.class.