Author: tchemit Date: 2010-06-09 12:15:46 +0200 (Wed, 09 Jun 2010) New Revision: 1959 Url: http://nuiton.org/repositories/revision/jaxx/1959 Log: use ReflectionUtil api to obtain method Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/application/ActionExecutor.java Modified: trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/application/ActionExecutor.java =================================================================== --- trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/application/ActionExecutor.java 2010-06-08 17:36:46 UTC (rev 1958) +++ trunk/jaxx-runtime/src/main/java/jaxx/runtime/swing/application/ActionExecutor.java 2010-06-09 10:15:46 UTC (rev 1959) @@ -26,6 +26,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.nuiton.util.ReflectUtil; import javax.swing.SwingWorker; import java.beans.PropertyChangeEvent; @@ -232,31 +233,11 @@ // find method Class<?> klass = methodContainer.getClass(); - Method mFound = null; - for (Method m : klass.getDeclaredMethods()) { - if (!methodName.equals(m.getName())) { - continue; - } - //same method name - - Class<?>[] types = m.getParameterTypes(); - if (arguments.length != types.length) { - continue; - } - - // same number arguments - mFound = m; - break; - } - if (mFound == null) { - throw new IllegalArgumentException( - "could not find method " + methodName + " on type " + - klass.getName()); - } - - //TODO Test arguments are on good type... - - final Method targetMethod = mFound; + final Method targetMethod= ReflectUtil.getDeclaredMethod(klass, + methodName, + true, + arguments + ); targetMethod.setAccessible(true); Runnable result;