public static Method getMethod ( String name , Object target , Object [ ] args ) { Class < ? > tclass = target . getClass ( ) ; Method meth = null ; try { MethodFinder finder = new MethodFinder ( tclass ) ; meth = finder . findMethod ( name , args ) ; } catch ( NoSuchMethodException nsme ) { // nothing to do here but fall through and return null log . info ( "No such method" , "name" , name , "tclass" , tclass . getName ( ) , "args" , args , "error" , nsme ) ; } catch ( SecurityException se ) { log . warning ( "Unable to look up method?" , "tclass" , tclass . getName ( ) , "mname" , name ) ; } return meth ; }
Looks up the method on the specified object that has a signature that matches the supplied arguments array . This is very expensive so you shouldn t be doing this for something that happens frequently .