com.zipxap.vfs.dal.utility
Class ReflectionUtility

java.lang.Object
  extended by com.zipxap.vfs.dal.utility.ReflectionUtility

public class ReflectionUtility
extends java.lang.Object


Constructor Summary
ReflectionUtility()
           
 
Method Summary
static int getAbstractionLevelsFromSubClassToBaseClass(java.lang.Class subClass, java.lang.Class superClass)
          Get the number of classes from superClass to subClass.
static java.lang.reflect.Field getField(java.lang.Class clazz, java.lang.String fieldName)
          This method retrieves the first instance of a field matching fieldName (this field could be masking a field of the same name in a base class).
static java.lang.reflect.Field[] getFields(java.lang.Class clazz)
          Retrieve all fields in the specified class and all superclasses (except Object).
static java.lang.reflect.Method getMethod(java.lang.Class clazz, java.lang.String methodName)
          Retrieve the method of the given name, regardless of access scope or arguments.
static java.lang.reflect.Method getMethod(java.lang.Class clazz, java.lang.String methodName, int nArguments)
          Retrieve the method of the given name with the given number of arguments, regardless of access scope.
static java.lang.reflect.Method[] getMethods(java.lang.Class clazz)
          Retrieve all fields in the specified class and all superclasses (except Object).
static boolean isClassAClassBorSubclassOfB(java.lang.Class classA, java.lang.Class classB)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReflectionUtility

public ReflectionUtility()
Method Detail

isClassAClassBorSubclassOfB

public static boolean isClassAClassBorSubclassOfB(java.lang.Class classA,
                                                  java.lang.Class classB)

getAbstractionLevelsFromSubClassToBaseClass

public static int getAbstractionLevelsFromSubClassToBaseClass(java.lang.Class subClass,
                                                              java.lang.Class superClass)
Get the number of classes from superClass to subClass.

Parameters:
subClass -
superClass -
Returns:
The number of classes from superClass to subClass, else -1 if subClass is not really a subclass of the given superClass.

getMethod

public static java.lang.reflect.Method getMethod(java.lang.Class clazz,
                                                 java.lang.String methodName)
Retrieve the method of the given name, regardless of access scope or arguments.

Parameters:
clazz - The class to search
methodName - the method to search for
Returns:
the Method of the given name, regardless of access scope or
Throws:
UCException - if there is more than one method with this name.

getField

public static java.lang.reflect.Field getField(java.lang.Class clazz,
                                               java.lang.String fieldName)
This method retrieves the first instance of a field matching fieldName (this field could be masking a field of the same name in a base class).

Parameters:
clazz -
fieldName -
Returns:
the first instance of a field matching fieldName (this field could be masking a field of the same name in a base class)

getMethod

public static java.lang.reflect.Method getMethod(java.lang.Class clazz,
                                                 java.lang.String methodName,
                                                 int nArguments)
Retrieve the method of the given name with the given number of arguments, regardless of access scope.

Parameters:
clazz - The class to search
methodName - the method to retreive.
nArguments - the number of arguments taken by the method to retreive.
Returns:
the Method of the given name, regardless of access scope or
Throws:
UCException - if there is more than one method with this name.

getMethods

public static java.lang.reflect.Method[] getMethods(java.lang.Class clazz)
Retrieve all fields in the specified class and all superclasses (except Object).

Parameters:
clazz - the class to retrieve the fields for.
Returns:
the list of declared fields fields in the specified class, including the fields defined in any superclasses.

getFields

public static java.lang.reflect.Field[] getFields(java.lang.Class clazz)
Retrieve all fields in the specified class and all superclasses (except Object).

Parameters:
clazz - the class to retrieve the fields for.
Returns:
the list of declared fields fields in the specified class, including the fields defined in any superclasses.