|
|||||||||
| 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(java.lang.Class<T> targetClass,
java.lang.Object obj)
Casts an object to the class or interface represented by the targetClass Class object. |
|
static java.util.List<java.lang.reflect.Method> |
getAllMethodsByName(java.lang.Class<?> cls,
java.lang.String methodName)
Find all methods with a specific name on a class and it's super classes regardless of parameter signature. |
|
static java.util.List<java.lang.reflect.Method> |
getAllMethodsByPrefix(java.lang.Class<?> clazz,
java.lang.String methodNamePrefix)
Find all methods starting with the specified prefix on the specified class |
|
static java.lang.Class<?> |
getClassFromTypeName(java.lang.String type,
java.lang.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 java.lang.reflect.Method |
getPrivateMethod(java.lang.Class<?> cls,
java.lang.String methodName,
java.lang.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(java.lang.Class<T> targetClass,
java.lang.Object obj)
obj - the object to be cast
java.lang.ClassCastException - if the object is not
null and is not assignable to the type T.
public static java.util.List<java.lang.reflect.Method> getAllMethodsByName(java.lang.Class<?> cls,
java.lang.String methodName)
cls - the class to scanmethodName - the name of the methods to find
public static java.util.List<java.lang.reflect.Method> getAllMethodsByPrefix(java.lang.Class<?> clazz,
java.lang.String methodNamePrefix)
clazz - methodNamePrefix -
public static java.lang.reflect.Method getPrivateMethod(java.lang.Class<?> cls,
java.lang.String methodName,
java.lang.Class<?>... paramTypes)
throws java.lang.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
java.lang.NoSuchMethodException - if no method can be found
public static final java.lang.Class<?> getClassFromTypeName(java.lang.String type,
java.lang.ClassLoader cl)
type - cl -
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||