Methods Summary |
---|
public static java.lang.Object | getField(java.lang.Object obj, java.lang.String fieldName)Get the value of a field in an object.
try {
Field field = obj.getClass().getDeclaredField(fieldName);
field.setAccessible(true);
return field.get(obj);
} catch (Exception t) {
throwBuildException(t);
return null; // NotReached
}
|
public static java.lang.Object | invoke(java.lang.Object obj, java.lang.String methodName)Call a method on the object with no parameters.
try {
Method method;
method = obj.getClass().getMethod(
methodName, (Class[]) null);
return method.invoke(obj, (Object[]) null);
} catch (Exception t) {
throwBuildException(t);
return null; // NotReached
}
|
public static java.lang.Object | invoke(java.lang.Object obj, java.lang.String methodName, java.lang.Class argType, java.lang.Object arg)Call a method on the object with one argument.
try {
Method method;
method = obj.getClass().getMethod(
methodName, new Class[] {argType});
return method.invoke(obj, new Object[] {arg});
} catch (Exception t) {
throwBuildException(t);
return null; // NotReached
}
|
public static java.lang.Object | invoke(java.lang.Object obj, 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 two argument.
try {
Method method;
method = obj.getClass().getMethod(
methodName, new Class[] {argType1, argType2});
return method.invoke(obj, new Object[] {arg1, arg2});
} catch (Exception t) {
throwBuildException(t);
return null; // NotReached
}
|
public static void | throwBuildException(java.lang.Exception t)A method to convert an invocationTargetException to
a buildexception and throw it.
if (t instanceof InvocationTargetException) {
Throwable t2 = ((InvocationTargetException) t)
.getTargetException();
if (t2 instanceof BuildException) {
throw (BuildException) t2;
}
throw new BuildException(t2);
} else {
throw new BuildException(t);
}
|