public class ContainerMethodAnnotationProcessor extends Object
An ContainerMethod annotation lifecycle.
Scan methods annotated directly by ContainerMethod
in the class or methods bound by annotations on class,
and adapt it to Container comparator according to given MethodContainerFactory.
ContainerMethod,
MethodContainerFactory| 限定符和类型 | 字段和说明 |
|---|---|
protected AnnotationFinder |
annotationFinder
annotation finder
|
protected Collection<MethodContainerFactory> |
methodContainerFactories
method container factories
|
protected Set<Class<?>> |
nonAnnotatedClasses
non annotated classes
|
| 构造器和说明 |
|---|
ContainerMethodAnnotationProcessor(Collection<MethodContainerFactory> methodContainerFactories,
AnnotationFinder annotationFinder)
Create a
ContainerMethodAnnotationProcessor comparator. |
| 限定符和类型 | 方法和说明 |
|---|---|
protected void |
collectClassLevelAnnotatedMethods(Class<?> type,
Method[] allMethods,
MultiMap<Method,ContainerMethod> annotatedMethods)
Collect methods bound by class level annotation.
|
protected Method[] |
collectMethodLevelAnnotatedMethods(Class<?> type,
MultiMap<Method,ContainerMethod> annotatedMethods)
Collect methods annotated with
ContainerMethod. |
protected @Nullable Method |
findMostMatchMethod(@NonNull List<Method> candidates,
@NonNull Class<?>[] expectedTypes)
Find most matched method by given method name and param types,
the method with the most matched parameter types will be returned.
|
Collection<Container<Object>> |
process(Object target,
Class<?> type)
process target
|
protected Collection<Container<Object>> |
processAnnotatedMethod(Object target,
MultiMap<Method,ContainerMethod> annotatedMethods)
process annotated method.
|
protected Collection<ContainerMethod> |
resolveAnnotationsForClass(Class<?> type)
Resolve annotations for class.
|
protected Collection<ContainerMethod> |
resolveAnnotationsForMethod(Method method)
Resolve annotations for class.
|
protected final AnnotationFinder annotationFinder
protected final Collection<MethodContainerFactory> methodContainerFactories
public ContainerMethodAnnotationProcessor(Collection<MethodContainerFactory> methodContainerFactories, AnnotationFinder annotationFinder)
ContainerMethodAnnotationProcessor comparator.methodContainerFactories - method container factoriesannotationFinder - annotation finderpublic final Collection<Container<Object>> process(Object target, Class<?> type)
target - targettype - typeprotected void collectClassLevelAnnotatedMethods(Class<?> type, Method[] allMethods, MultiMap<Method,ContainerMethod> annotatedMethods)
type - typeallMethods - all methods in typeannotatedMethods - annotated methodsprotected Method[] collectMethodLevelAnnotatedMethods(Class<?> type, MultiMap<Method,ContainerMethod> annotatedMethods)
ContainerMethod.type - typeannotatedMethods - annotated methodsprotected Collection<Container<Object>> processAnnotatedMethod(Object target, MultiMap<Method,ContainerMethod> annotatedMethods)
target - targetannotatedMethods - annotated methodsprotected Collection<ContainerMethod> resolveAnnotationsForClass(Class<?> type)
type - typeprotected Collection<ContainerMethod> resolveAnnotationsForMethod(Method method)
method - methodprotected @Nullable Method findMostMatchMethod(@NonNull List<Method> candidates, @NonNull Class<?>[] expectedTypes)
Find most matched method by given method name and param types,
the method with the most matched parameter types will be returned.
If there are multiple methods with the same number of matched parameter types or no matched method,
the first one will be returned.
candidates - methods which have the same name, list size must be greater than 0expectedTypes - param typesCopyright © 2023. All rights reserved.