@FunctionalInterface public interface AnnotationProcessor
注解处理器,用于在AbstractAnnotationScanner扫描到注解后,完成一些回调处理。
当扫描器每次调用accept(int, int, Annotation)后,
都会对应的调用一次interrupted()方法,若返回值为true,
则扫描器将会中断正在进行从扫描进程。
若一个处理器已经中断,则再次调用accept(int, int, Annotation)方法后,将不会对传入的注解进行任何处理。
AnnotationFinder: 用于从元素上查找符合条件的注解,当找到后将直接中断扫描进程;AnnotationCollector: 用于收集扫描过程中获取到的注解;AbstractAnnotationScanner,
AnnotationFinder,
AnnotationCollector| 限定符和类型 | 方法和说明 |
|---|---|
void |
accept(int verticalIndex,
int horizontalIndex,
Annotation annotation)
处理注解
|
default boolean |
interrupted()
是否中断扫描器的扫描进程
|
default boolean interrupted()
void accept(int verticalIndex,
int horizontalIndex,
Annotation annotation)
verticalIndex - 垂直索引。一般表示与扫描器扫描的AnnotatedElement相隔的层级层次。默认从开始horizontalIndex - 水平索引,一般用于衡量两个注解对象之间被扫描到的先后顺序。默认从1开始annotation - 被扫描到的注解对象Copyright © 2022. All rights reserved.