org.jboss.ejb3.interceptors.lang
Class ClassHelper

java.lang.Object
  extended by org.jboss.ejb3.interceptors.lang.ClassHelper

public class ClassHelper
extends Object

Methods which should have been in Class.

Version:
$Revision: 86909 $
Author:
Carlo de Wolf

Constructor Summary
ClassHelper()
           
 
Method Summary
static Method[] getAllMethods(Class<?> cls)
          Returns all public, private and package protected methods including inherited ones.
static Map<String,List<Method>> getAllMethodsMap(Class<?> cls)
          Returns all public, private and package protected methods including inherited ones in a map indexed by name.
static Method getMethod(Class<?> cls, String methodName)
          Returns the method with the specified method name.
static Method getMethod(Class<?> cls, String methodName, Class<?>... params)
          Returns the method with the specified method name and parameters.
static Method[] getMethods(Class<?> klass, Class<?> returnType, Class<?>... paramTypes)
          Returns all (public,private, package, protected) methods belonging to the klass and its superclasses whose params match the paramTypes and whose return type is returnType
static boolean isOverridden(Class<?> icptr, Method method)
           
static boolean isOverridden(Method method, Method... methods)
          Checks whether the method is overriden by any of the methods *in the passed collection of methods*.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassHelper

public ClassHelper()
Method Detail

getAllMethods

public static Method[] getAllMethods(Class<?> cls)
Returns all public, private and package protected methods including inherited ones. (Slow method)

Parameters:
cls -
Returns:

getMethod

public static Method getMethod(Class<?> cls,
                               String methodName)
                        throws NoSuchMethodException
Returns the method with the specified method name. (Slow method)

Parameters:
methodName -
Returns:
Throws:
NoSuchMethodException

getMethod

public static Method getMethod(Class<?> cls,
                               String methodName,
                               Class<?>... params)
                        throws NoSuchMethodException
Returns the method with the specified method name and parameters.

Parameters:
cls -
methodName -
params -
Returns:
Throws:
NoSuchMethodException

getAllMethodsMap

public static Map<String,List<Method>> getAllMethodsMap(Class<?> cls)
Returns all public, private and package protected methods including inherited ones in a map indexed by name. (Slow method)

Parameters:
cls -
Returns:

isOverridden

public static boolean isOverridden(Class<?> icptr,
                                   Method method)

getMethods

public static Method[] getMethods(Class<?> klass,
                                  Class<?> returnType,
                                  Class<?>... paramTypes)
Returns all (public,private, package, protected) methods belonging to the klass and its superclasses whose params match the paramTypes and whose return type is returnType

Parameters:
klass -
paramTypes -
Returns:

isOverridden

public static boolean isOverridden(Method method,
                                   Method... methods)
Checks whether the method is overriden by any of the methods *in the passed collection of methods*. Returns true if the method is overriden by any of the passed methods, else returns false.

Parameters:
method -
methods -
Returns:


Copyright © 2009 JBoss, a division of Red Hat, Inc.. All Rights Reserved.