我正在使用这个 Java Reflections API,到目前为止我发现它非常方便:
https://github.com/ronmamo/reflections
查找所有标有特定注释的类非常容易,但是,我不知道如何在扫描仪中添加过滤器来检索以某种方式配置了该注释的类。
例如,如果我有三个类:
@Important(level="high")
public class HighlyImportant { }
@Important(level="medium")
public class ModeratelyImportant { }
@Important(level="low")
public class NotSoImportant { }
我可以通过扫描 @Important 注释来获得所有三个类,但是如何将其限制为仅 @Important(level=high) ?
谢谢