public static Method getMethodByName ( final Class < ? > cls , final String action ) throws NoSuchMethodException { for ( final Method m : cls . getMethods ( ) ) { if ( m . getName ( ) . equals ( action ) ) { return m ; } } throw new NoSuchMethodException ( action ) ; }
Return the method that exactly match the action name . The name must be unique into the class .