org.jagatoo.util.classes
Class ClassUtil

java.lang.Object
  extended by org.jagatoo.util.classes.ClassUtil

public class ClassUtil
extends java.lang.Object

The ClassUtil provides utility methods to deal with classes.


Constructor Summary
ClassUtil()
           
 
Method Summary
static java.lang.reflect.Method findMethod(java.lang.Class<?> clazz, java.lang.String methodName, java.lang.Class<?>... parameterTypes)
          Gets the method from the given class without exceptions and also searches super classes.
static java.lang.reflect.Method getPublicMethod(java.lang.Class<?> clazz, java.lang.String methodName, java.lang.Class<?>... parameterTypes)
          Gets the public method from the given class without exceptions.
static java.lang.Boolean overridesMethod(java.lang.Class<?> baseClazz, java.lang.Class<?> clazz, java.lang.String methodName, java.lang.Class<?>... parameterTypes)
          Checks, whether the given Class 'clazz' overrides the given method in the Class 'baseClazz'.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassUtil

public ClassUtil()
Method Detail

getPublicMethod

public static java.lang.reflect.Method getPublicMethod(java.lang.Class<?> clazz,
                                                       java.lang.String methodName,
                                                       java.lang.Class<?>... parameterTypes)
Gets the public method from the given class without exceptions.

Parameters:
clazz -
methodName -
parameterTypes -
Returns:
the method or null, if it doesn't exist or other problems occurr.

findMethod

public static java.lang.reflect.Method findMethod(java.lang.Class<?> clazz,
                                                  java.lang.String methodName,
                                                  java.lang.Class<?>... parameterTypes)
Gets the method from the given class without exceptions and also searches super classes.

Parameters:
clazz -
methodName -
parameterTypes -
Returns:
the method or null, if it doesn't exist or other problems occurr.

overridesMethod

public static java.lang.Boolean overridesMethod(java.lang.Class<?> baseClazz,
                                                java.lang.Class<?> clazz,
                                                java.lang.String methodName,
                                                java.lang.Class<?>... parameterTypes)
Checks, whether the given Class 'clazz' overrides the given method in the Class 'baseClazz'.

Parameters:
baseClazz - the Class declaring the base method
clazz - the sub class possibly overriding the method
methodName - the name of the method
parameterTypes - the parameters of the method
Returns:
true, if the class overrides the given method, false if not, null, if the method doesn't exist or another error occurrs.