|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.fulcrum.yaafi.framework.reflection.Clazz
public class Clazz
Helper clazz to do a little bit of reflection magic.
Constructor Summary | |
---|---|
Clazz()
|
Method Summary | |
---|---|
static List |
getAllInterfaces(Class cls)
Gets a List of all interfaces implemented by the given
class and its superclasses. |
static Class |
getClazz(ClassLoader classLoader,
String clazzName)
Loads a class with the given name. |
static boolean |
hasClazz(ClassLoader classLoader,
String clazzName)
Determine if the class can be loaded. |
static Object |
invoke(Class clazz,
String methodName,
Class[] signature,
Object[] args)
Invokes a static method on a class. |
static Object |
invoke(Object instance,
String methodName,
Class[] signature,
Object[] args)
Invokes a given method on the instance. |
static Object |
newInstance(Class clazz,
Class[] signature,
Object[] args)
Creates a new instance of the class |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Clazz()
Method Detail |
---|
public static boolean hasClazz(ClassLoader classLoader, String clazzName)
classLoader
- the classloader to be usedclazzName
- the name of the class to be loaded
public static Class getClazz(ClassLoader classLoader, String clazzName) throws ClassNotFoundException
classLoader
- the class loader to be usedclazzName
- the name of the clazz to be loaded
ClassNotFoundException
- the class was nout foundpublic static Object newInstance(Class clazz, Class[] signature, Object[] args) throws NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException
clazz
- the class to be instantiatedsignature
- the signature of the constructorargs
- the arguments to be passed
NoSuchMethodException
- the method was not found
InvocationTargetException
- an exception was thrown in the constructor
InstantiationException
- the target class could not be instantiated
IllegalAccessException
- an field couldn't be accessedpublic static Object invoke(Object instance, String methodName, Class[] signature, Object[] args) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException
instance
- the instancemethodName
- the name of the method to be invokedsignature
- the signature of the methodargs
- the arguments for the method invocation
NoSuchMethodException
- the method was not found
InvocationTargetException
- an exception was thrown in the constructor
IllegalAccessException
- an field couldn't be accessedpublic static Object invoke(Class clazz, String methodName, Class[] signature, Object[] args) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException
clazz
- the class instance to work onmethodName
- the name of the method to be invokedsignature
- the signature of the methodargs
- the arguments for the method invocation
NoSuchMethodException
- the method was not found
InvocationTargetException
- an exception was thrown in the constructor
IllegalAccessException
- an field couldn't be accessedpublic static List getAllInterfaces(Class cls)
Gets a List
of all interfaces implemented by the given
class and its superclasses.
The order is determined by looking through each interface in turn as declared in the source file and following its hierarchy up. Then each superclass is considered in the same way. Later duplicates are ignored, so the order is maintained.
cls
- the class to look up, may be null
List
of interfaces in order,
null
if null input
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |