| java.lang.Object org.apache.tools.ant.util.ReflectUtil
ReflectUtil | public class ReflectUtil (Code) | | Utility class to handle reflection on java objects.
The class contains static methods to call reflection
methods, catch any exceptions, converting them
to BuildExceptions.
|
Method Summary | |
public static Object | getField(Object obj, String fieldName) Get the value of a field in an object.
Parameters: obj - the object to look at. Parameters: fieldName - the name of the field in the object. | public static Object | invoke(Object obj, String methodName) Call a method on the object with no parameters. | public static Object | invoke(Object obj, String methodName, Class argType, Object arg) Call a method on the object with one argument.
Parameters: obj - the object to invoke the method on. Parameters: methodName - the name of the method to call Parameters: argType - the type of argument. Parameters: arg - the value of the argument. | public static Object | invoke(Object obj, String methodName, Class argType1, Object arg1, Class argType2, Object arg2) Call a method on the object with two argument.
Parameters: obj - the object to invoke the method on. Parameters: methodName - the name of the method to call Parameters: argType1 - the type of the first argument. Parameters: arg1 - the value of the first argument. Parameters: argType2 - the type of the second argument. Parameters: arg2 - the value of the second argument. | public static void | throwBuildException(Exception t) A method to convert an invocationTargetException to
a buildexception and throw it. |
getField | public static Object getField(Object obj, String fieldName) throws BuildException(Code) | | Get the value of a field in an object.
Parameters: obj - the object to look at. Parameters: fieldName - the name of the field in the object. the value of the field. throws: BuildException - if there is an error. |
invoke | public static Object invoke(Object obj, String methodName)(Code) | | Call a method on the object with no parameters.
Parameters: obj - the object to invoke the method on. Parameters: methodName - the name of the method to call the object returned by the method |
invoke | public static Object invoke(Object obj, String methodName, Class argType, Object arg)(Code) | | Call a method on the object with one argument.
Parameters: obj - the object to invoke the method on. Parameters: methodName - the name of the method to call Parameters: argType - the type of argument. Parameters: arg - the value of the argument. the object returned by the method |
invoke | public static Object invoke(Object obj, String methodName, Class argType1, Object arg1, Class argType2, Object arg2)(Code) | | Call a method on the object with two argument.
Parameters: obj - the object to invoke the method on. Parameters: methodName - the name of the method to call Parameters: argType1 - the type of the first argument. Parameters: arg1 - the value of the first argument. Parameters: argType2 - the type of the second argument. Parameters: arg2 - the value of the second argument. the object returned by the method |
throwBuildException | public static void throwBuildException(Exception t) throws BuildException(Code) | | A method to convert an invocationTargetException to
a buildexception and throw it.
Parameters: t - the invocation target exception. throws: BuildException - the converted exception. |
|
|