public static Method findMethod ( final Class < ? > c , String methodName , final Class < ? > [ ] parmTypes ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "findMethod" , new Object [ ] { c , methodName , Arrays . toString ( parmTypes ) } ) ; } // Start with specified class. Class < ? > classObject = c ; // Use java reflection to locate method until Method is found // or we have reflected entire inheritance tree. Method m = null ; while ( classObject != null && m == null ) //d461068 { try { // Attempt to find in current Class object. m = classObject . getDeclaredMethod ( methodName , parmTypes ) ; } catch ( NoSuchMethodException e ) { // Look in super class if not found. classObject = classObject . getSuperclass ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { if ( classObject != null ) //d461068 { Tr . debug ( tc , "searching superclass: " + classObject . getName ( ) ) ; } else { Tr . debug ( tc , methodName + " was not found" ) ; } } } } // Return Method object or null if not found. if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "findMethod returning: " + m ) ; } return m ; }
Returns a Method object that reflects the specified method of a specified EJB or interceptor class . The methodName parameter is a String that specifies the simple name of the desired method and the parameterTypes parameter is an array of Class objects that identify the method s formal parameter types in the declared order . If more than one method with the same parameter types is declared in a class and one of these methods has a return type that is more specific than any of the others that method is returned ; otherwise one of the methods is chosen arbitrarily . If the specified class is extended and the methodName exists in more than one class of the inheritance tree then the subclass method is returned rather than the method in the more generic class .