public static boolean isPublicMethodFinal ( Class clazz , String name , TypeDesc retType , TypeDesc [ ] params ) { if ( ! clazz . isInterface ( ) ) { Class [ ] paramClasses ; if ( params == null || params . length == 0 ) { paramClasses = null ; } else { paramClasses = new Class [ params . length ] ; for ( int i = 0 ; i < params . length ; i ++ ) { paramClasses [ i ] = params [ i ] . toClass ( ) ; } } try { Method existing = clazz . getMethod ( name , paramClasses ) ; if ( Modifier . isFinal ( existing . getModifiers ( ) ) ) { if ( retType == null ) { retType = TypeDesc . forClass ( void . class ) ; } if ( TypeDesc . forClass ( existing . getReturnType ( ) ) == retType ) { // Method is already implemented and is final. return true ; } } } catch ( NoSuchMethodException e ) { } } return false ; }
Returns true if a public final method exists which matches the given specification .