From 5750c6cfc54c087bf9c1ced4ff14ce571cd8013c Mon Sep 17 00:00:00 2001 From: Kevin Jackson Date: Fri, 16 Mar 2007 09:08:12 +0000 Subject: [PATCH] -added simple respondsTo method git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@518894 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/tools/ant/util/ReflectUtil.java | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/main/org/apache/tools/ant/util/ReflectUtil.java b/src/main/org/apache/tools/ant/util/ReflectUtil.java index 70be59a4e..36f570510 100644 --- a/src/main/org/apache/tools/ant/util/ReflectUtil.java +++ b/src/main/org/apache/tools/ant/util/ReflectUtil.java @@ -136,4 +136,28 @@ public class ReflectUtil { throw new BuildException(t); } } -} + + /** + * A method to test if an object responds to a given + * message (method call) + * @param o the object + * @param methodName the method to check for + * @return + * @throws BuildException + */ + public static boolean resondsTo(Object o, String methodName) + throws BuildException { + try { + Method[] methods = o.getClass().getMethods(); + for(int i=0; i