Package org.apache.tools.ant.util
Class ReflectWrapper
- java.lang.Object
- 
- org.apache.tools.ant.util.ReflectWrapper
 
- 
 public class ReflectWrapper extends java.lang.ObjectUtility class to handle reflection on java objects. The class is a holder class for an object and uses java reflection to call methods on the objects. If things go wrong, BuildExceptions are thrown.
- 
- 
Constructor SummaryConstructors Constructor Description ReflectWrapper(java.lang.ClassLoader loader, java.lang.String name)Construct a wrapped object using the no arg constructor.ReflectWrapper(java.lang.Object obj)Constructor using a passed in object.
 - 
Method SummaryModifier and Type Method Description <T> TgetObject()<T> Tinvoke(java.lang.String methodName)Call a method on the object with no parameters.<T> Tinvoke(java.lang.String methodName, java.lang.Class<?> argType, java.lang.Object arg)Call a method on the object with one argument.<T> Tinvoke(java.lang.String methodName, java.lang.Class<?> argType1, java.lang.Object arg1, java.lang.Class<?> argType2, java.lang.Object arg2)Call a method on the object with one argument.
 
- 
- 
- 
Constructor Detail- 
ReflectWrapperpublic ReflectWrapper(java.lang.ClassLoader loader, java.lang.String name)Construct a wrapped object using the no arg constructor.- Parameters:
- loader- the classloader to use to construct the class.
- name- the classname of the object to construct.
 
 - 
ReflectWrapperpublic ReflectWrapper(java.lang.Object obj) Constructor using a passed in object.- Parameters:
- obj- the object to wrap.
 
 
- 
 - 
Method Detail- 
getObjectpublic <T> T getObject() - Type Parameters:
- T- desired type
- Returns:
- the wrapped object.
 
 - 
invokepublic <T> T invoke(java.lang.String methodName) Call a method on the object with no parameters.- Type Parameters:
- T- desired type
- Parameters:
- methodName- the name of the method to call
- Returns:
- the object returned by the method
 
 - 
invokepublic <T> T invoke(java.lang.String methodName, java.lang.Class<?> argType, java.lang.Object arg)Call a method on the object with one argument.- Type Parameters:
- T- desired type
- Parameters:
- 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
 
 - 
invokepublic <T> T invoke(java.lang.String methodName, java.lang.Class<?> argType1, java.lang.Object arg1, java.lang.Class<?> argType2, java.lang.Object arg2)Call a method on the object with one argument.- Type Parameters:
- T- desired type
- Parameters:
- 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
 
 
- 
 
-