Reflection Command

The ReflectionCommand provides a simple mechanism for invoking methods on existing classes. You would typically use these to wrap an existing method with a command in one line of code.

   public class Target
   {
      public void performTask()
      {
          ...
      }
   }

   Target target = new Target();

   // create a command that will execute target.performTask()
   command = new ReflectionCommand("myCommandId", target, "performTask");

You can optionally implement getInvocationArgs() to provide arguments for the target method, and handleInvocationException() to handle any exceptions.

Since 2.1 you can also use annotations to create and bind commands from existing methods.