|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.sf.jlaunchpad.util.ReflectionUtil
public class ReflectionUtil
This is the class for holding reflection utilities.
| Constructor Summary | |
|---|---|
ReflectionUtil()
|
|
| Method Summary | |
|---|---|
static java.lang.reflect.Method |
getMainMethod(java.lang.Class clazz)
Searches for the "main" method. |
protected static java.lang.reflect.Method |
getMainMethod(java.lang.Class clazz,
java.lang.Class[] paramTypes)
Searches for the "main" method. |
static java.lang.reflect.Method |
getMainMethodWithTwoParameters(java.lang.Class clazz,
java.lang.Class secondParameterClass)
Searches for the "main" method. |
static java.lang.Object |
getPrivateField(java.lang.Object source,
java.lang.Class clazz,
java.lang.String name)
Gets the private filed. |
static java.lang.Object |
invokePrivateMethod(java.lang.Object source,
java.lang.Object[] parameters,
java.lang.Class clazz,
java.lang.String name,
java.lang.Class[] parameterTypes)
Invokes the private method. |
static java.lang.Object |
launchClass(java.lang.Class mainClass,
java.lang.String[] args,
java.lang.String illegalArgumentMessage)
Tries to launch the class. |
static java.lang.Object |
launchClass(java.lang.reflect.Method mainMethod,
java.lang.Object[] args,
java.lang.String illegalArgumentMessage)
Tries to launch the class. |
static void |
setPrivateField(java.lang.Object source,
java.lang.Class clazz,
java.lang.String name,
java.lang.Object value)
Sets the private filed. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ReflectionUtil()
| Method Detail |
|---|
public static java.lang.reflect.Method getMainMethod(java.lang.Class clazz)
clazz - the class where we are searching for "main" methd
public static java.lang.reflect.Method getMainMethodWithTwoParameters(java.lang.Class clazz,
java.lang.Class secondParameterClass)
clazz - the class where we are searching for "main" methdsecondParameterClass - second parameter class
protected static java.lang.reflect.Method getMainMethod(java.lang.Class clazz,
java.lang.Class[] paramTypes)
clazz - the class where we are searching for "main" methdparamTypes - parameter types
public static java.lang.Object launchClass(java.lang.Class mainClass,
java.lang.String[] args,
java.lang.String illegalArgumentMessage)
throws java.lang.IllegalAccessException,
java.lang.reflect.InvocationTargetException
mainClass - the class to be launchedargs - the list of argumentsillegalArgumentMessage - the message to be displayed if main method cannot be found
java.lang.IllegalAccessException - exception
java.lang.reflect.InvocationTargetException - exception
public static java.lang.Object launchClass(java.lang.reflect.Method mainMethod,
java.lang.Object[] args,
java.lang.String illegalArgumentMessage)
throws java.lang.IllegalAccessException,
java.lang.reflect.InvocationTargetException
mainMethod - main methodargs - the list of argumentsillegalArgumentMessage - the message to be displayed if main method cannot be found
java.lang.IllegalAccessException - exception
java.lang.reflect.InvocationTargetException - exception
public static java.lang.Object getPrivateField(java.lang.Object source,
java.lang.Class clazz,
java.lang.String name)
throws java.lang.NoSuchFieldException,
java.lang.IllegalAccessException
source - the source objectname - the field name to accessclazz - the class
java.lang.NoSuchFieldException - the exception
java.lang.IllegalAccessException - the exception
public static void setPrivateField(java.lang.Object source,
java.lang.Class clazz,
java.lang.String name,
java.lang.Object value)
throws java.lang.NoSuchFieldException,
java.lang.IllegalAccessException
source - the source objectclazz - the classname - the field name to accessvalue - the value
java.lang.NoSuchFieldException - the exception
java.lang.IllegalAccessException - the exception
public static java.lang.Object invokePrivateMethod(java.lang.Object source,
java.lang.Object[] parameters,
java.lang.Class clazz,
java.lang.String name,
java.lang.Class[] parameterTypes)
throws java.lang.NoSuchMethodException,
java.lang.IllegalAccessException,
java.lang.reflect.InvocationTargetException
source - the source objectparameters - the parameters listclazz - the source classname - the method nameparameterTypes - the list of parameter types
java.lang.NoSuchMethodException - the exception
java.lang.IllegalAccessException - the exception
java.lang.reflect.InvocationTargetException - the exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||