public Object invoke(Object target, Object[] args) throws Throwable { if(args != null) this.args=args; return invoke(target);
public Object invoke(Object target) throws Throwable { Class  cl; Method meth=null; Object retval=null;   if(method_name == null || target == null) { if(log.isErrorEnabled()) log.error("method name or target is null"); return null; } cl=target.getClass(); try { switch(mode) { case OLD: meth=findMethod(cl); break; case METHOD: if(this.method != null) meth=this.method; break; case TYPES: meth=cl.getMethod(method_name, types); break; case SIGNATURE: Class[] mytypes=null; if(signature != null) mytypes=getTypesFromString(cl, signature); meth=cl.getMethod(method_name, mytypes); break; default: if(log.isErrorEnabled()) log.error("mode " + mode + " is invalid"); break; }  if(meth != null) { retval=meth.invoke(target, args); } else { if(log.isErrorEnabled()) log.error("method " + method_name + " not found"); } return retval; } catch(InvocationTargetException inv_ex) { throw inv_ex.getTargetException(); } catch(NoSuchMethodException no) { StringBuffer sb=new StringBuffer(); sb.append("found no method called ").append(method_name).append(" in class "); sb.append(cl.getName()).append(" with ("); if(args != null) { for(int i=0; i < args.length; i++) { if(i > 0) sb.append(", "); sb.append((args[i] != null)? args[i].getClass().getName() : "null"); } } sb.append(") formal parameters"); log.error(sb.toString()); throw no; } catch(Throwable e) { if(log.isErrorEnabled()) log.error("exception=" + e); throw e; }
    public Object invoke(Object target, Object[] args) throws Throwable {        if(args != null)            this.args=args;        return invoke(target);    }