private static Method getInterfaceMethod ( Method method ) { for ( Class < ? > interfaceClass : method . getDeclaringClass ( ) . getInterfaces ( ) ) { try { return interfaceClass . getMethod ( method . getName ( ) , method . getParameterTypes ( ) ) ; } catch ( NoSuchMethodException unused ) { } } return method ; }
Get Java reflective method from interface . This getter attempt to locate a method with the same signature as requested base class method in any interface the declaring class may have . If no method found in interfaces or no interface present return given base class method . If requested base class method is declared in multiple interfaces this getter returns the first found but there is no guarantee for order .