org.apache.tools.ant.util
public class ReflectUtil extends Object
Method Summary | |
---|---|
static Object | getField(Object obj, String fieldName)
Get the value of a field in an object. |
static Object | invoke(Object obj, String methodName)
Call a method on the object with no parameters. |
static Object | invoke(Object obj, String methodName, Class argType, Object arg)
Call a method on the object with one argument. |
static Object | invoke(Object obj, String methodName, Class argType1, Object arg1, Class argType2, Object arg2)
Call a method on the object with two argument. |
static Object | invokeStatic(Object obj, String methodName)
Call a method on the object with no parameters.
|
static Object | newInstance(Class ofClass, Class[] argTypes, Object[] args)
Create an instance of a class using the constructor matching
the given arguments. |
static boolean | respondsTo(Object o, String methodName)
A method to test if an object responds to a given
message (method call) |
static void | throwBuildException(Exception t)
A method to convert an invocationTargetException to
a buildexception and throw it. |
static BuildException | toBuildException(Exception t)
A method to convert an invocationTargetException to
a buildexception. |
Parameters: obj the object to look at. fieldName the name of the field in the object.
Returns: the value of the field.
Throws: BuildException if there is an error.
Parameters: obj the object to invoke the method on. methodName the name of the method to call
Returns: the object returned by the method
Parameters: obj the object to invoke the method on. methodName the name of the method to call argType the type of argument. arg the value of the argument.
Returns: the object returned by the method
Parameters: obj the object to invoke the method on. methodName the name of the method to call argType1 the type of the first argument. arg1 the value of the first argument. argType2 the type of the second argument. arg2 the value of the second argument.
Returns: the object returned by the method
Parameters: obj the object to invoke the method on. methodName the name of the method to call
Returns: the object returned by the method
Since: Ant 1.8.0
Parameters: o the object methodName the method to check for
Returns: true if the object has the method.
Throws: BuildException if there is a problem.
Parameters: t the invocation target exception.
Throws: BuildException the converted exception.
Parameters: t the invocation target exception.
Returns: the converted exception.
Since: ant 1.7.1