Save This Page
Home » apache-ant-1.8.1 » org.apache.tools » ant » util » [javadoc | source]
org.apache.tools.ant.util
public class: ReflectUtil [javadoc | source]
java.lang.Object
   org.apache.tools.ant.util.ReflectUtil
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 from org.apache.tools.ant.util.ReflectUtil Summary:
getField,   invoke,   invoke,   invoke,   invokeStatic,   newInstance,   respondsTo,   throwBuildException,   toBuildException
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.tools.ant.util.ReflectUtil Detail:
 public static Object getField(Object obj,
    String fieldName) throws BuildException 
    Get the value of a field in an 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.
 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.
 public static Object invokeStatic(Object obj,
    String methodName) 
    Call a method on the object with no parameters. Note: Unlike the invoke method above, this calls class or static methods, not instance methods.
 public static Object newInstance(Class ofClass,
    Class[] argTypes,
    Object[] args) 
    Create an instance of a class using the constructor matching the given arguments.
 public static boolean respondsTo(Object o,
    String methodName) throws BuildException 
    A method to test if an object responds to a given message (method call)
 public static  void throwBuildException(Exception t) throws BuildException 
    A method to convert an invocationTargetException to a buildexception and throw it.
 public static BuildException toBuildException(Exception t) 
    A method to convert an invocationTargetException to a buildexception.