spring-framework / org.springframework.aop.support / AopUtils / getMostSpecificMethod

getMostSpecificMethod

open static fun getMostSpecificMethod(method: Method, @Nullable targetClass: Class<*>): Method

Given a method, which may come from an interface, and a target class used in the current AOP invocation, find the corresponding target method if there is one. E.g. the method may be IFoo.bar() and the target class may be DefaultFoo. In this case, the method may be DefaultFoo.bar(). This enables attributes on that method to be found.

NOTE: In contrast to org.springframework.util.ClassUtils#getMostSpecificMethod, this method resolves Java 5 bridge methods in order to retrieve attributes from the original method definition.

Parameters

method - the method to be invoked, which may come from an interface

targetClass - the target class for the current invocation. May be null or may not even implement the method.

Return
the specific target method, or the original method if the targetClass doesn't implement it or is null

See Also
org.springframework.util.ClassUtils#getMostSpecificMethod