public static Method bestMatchingMethod ( Collection < Method > methods , String methodName , Class [ ] types ) { if ( methods == null || StringUtils . isNullOrBlank ( methodName ) || types == null ) { return null ; } for ( Method method : methods ) { if ( method . getName ( ) . equals ( methodName ) && typesMatch ( method . getParameterTypes ( ) , types ) ) { return method ; } } return null ; }
Finds the best Method match for a given method name and types against a collection of methods .