|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.ejb3.common.lang.ClassHelper
public class ClassHelper
Useful methods for classes.
Constructor Summary | |
---|---|
ClassHelper()
|
Method Summary | ||
---|---|---|
static
|
cast(Class<T> targetClass,
Object obj)
Casts an object to the class or interface represented by the targetClass Class object. |
|
static List<Method> |
getAllMethodsByName(Class<?> cls,
String methodName)
Find all methods with a specific name on a class and it's super classes regardless of parameter signature. |
|
static List<Method> |
getAllMethodsByPrefix(Class<?> clazz,
String methodNamePrefix)
Find all methods starting with the specified prefix on the specified class |
|
static Class<?> |
getClassFromTypeName(String type,
ClassLoader cl)
Obtains a Class corresponding to the specified type using the specified ClassLoader, throwing a descriptive RuntimeException in the case the Class could not be found |
|
static Method |
getPrivateMethod(Class<?> cls,
String methodName,
Class<?>... paramTypes)
Returns the Method with the given attributes of either this class
or one of it's super classes. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ClassHelper()
Method Detail |
---|
public static <T> T cast(Class<T> targetClass, Object obj)
obj
- the object to be cast
ClassCastException
- if the object is not
null and is not assignable to the type T.public static List<Method> getAllMethodsByName(Class<?> cls, String methodName)
cls
- the class to scanmethodName
- the name of the methods to find
public static List<Method> getAllMethodsByPrefix(Class<?> clazz, String methodNamePrefix)
clazz
- methodNamePrefix
-
public static Method getPrivateMethod(Class<?> cls, String methodName, Class<?>... paramTypes) throws NoSuchMethodException
Method
with the given attributes of either this class
or one of it's super classes.
TODO: return type specifics are not considered
FIXME: rename method (it must return all modifiers)
cls
- class to scanmethodName
- the name of the methodparamTypes
- the parameter types
Method
matching the method name and parameters
NoSuchMethodException
- if no method can be foundpublic static final Class<?> getClassFromTypeName(String type, ClassLoader cl)
type
- cl
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |