类 MethodIntrospector
java.lang.Object
cn.taketoday.core.MethodIntrospector
Defines the algorithm for searching for metadata-associated methods exhaustively
including interfaces and parent classes while also dealing with parameterized methods
as well as common scenarios encountered with interface and class-based proxies.
Typically, but not necessarily, used for finding annotated handler methods.
- 从以下版本开始:
- 4.0
- 作者:
- Juergen Hoeller, Rossen Stoyanchev, TODAY 2021/11/11 10:26
-
嵌套类概要
嵌套类修饰符和类型类说明static interfaceA callback interface for metadata lookup on a given method. -
方法概要
修饰符和类型方法说明filterMethods(Class<?> targetType, ReflectionUtils.MethodFilter methodFilter) Select methods on the given target type based on a filter.static MethodselectInvocableMethod(Method method, Class<?> targetType) Select an invocable method on the target type: either the given method itself if actually exposed on the target type, or otherwise a corresponding method on one of the target type's interfaces or on the target type itself.selectMethods(Class<?> targetType, MethodIntrospector.MetadataLookup<T> metadataLookup) Select methods on the given target type based on the lookup of associated metadata.
-
方法详细资料
-
selectMethods
public static <T> Map<Method,T> selectMethods(Class<?> targetType, MethodIntrospector.MetadataLookup<T> metadataLookup) Select methods on the given target type based on the lookup of associated metadata.Callers define methods of interest through the
MethodIntrospector.MetadataLookupparameter, allowing to collect the associated metadata into the result map.- 参数:
targetType- the target type to search methods onmetadataLookup- aMethodIntrospector.MetadataLookupcallback to inspect methods of interest, returning non-null metadata to be associated with a given method if there is a match, ornullfor no match- 返回:
- the selected methods associated with their metadata (in the order of retrieval), or an empty map in case of no match
-
filterMethods
public static Set<Method> filterMethods(Class<?> targetType, ReflectionUtils.MethodFilter methodFilter) Select methods on the given target type based on a filter.Callers define methods of interest through the
MethodFilterparameter.- 参数:
targetType- the target type to search methods onmethodFilter- aMethodFilterto help recognize handler methods of interest- 返回:
- the selected methods, or an empty set in case of no match
-
selectInvocableMethod
Select an invocable method on the target type: either the given method itself if actually exposed on the target type, or otherwise a corresponding method on one of the target type's interfaces or on the target type itself.Matches on user-declared interfaces will be preferred since they are likely to contain relevant metadata that corresponds to the method on the target class.
- 参数:
method- the method to checktargetType- the target type to search methods on (typically an interface-based JDK proxy)- 返回:
- a corresponding invocable method on the target type
- 抛出:
IllegalStateException- if the given method is not invocable on the given target type (typically due to a proxy mismatch)
-