简体   繁体   English

如何在 Intellij IDEA 中找到注释的处理器类?

[英]How to find Processor class of an annotation in Intellij IDEA?

Given a Java annotation, how can I jump to its Processor class (class extending the AbstractProcessor interface) in Intellij IDEA?给定一个 Java 注释,如何在 Intellij IDEA 中跳转到它的 Processor 类(扩展AbstractProcessor接口的类)?

I tried full text search and find usage in project and libraries in Intellij IDEA, that is not working.我尝试了全文搜索,并在 Intellij IDEA 的项目和库中找到了用法,但这是行不通的。

Intellij Idea doesn't have something like find AnnotationProcessor for Annotation. Intellij Idea 没有像 find AnnotationProcessor for Annotation 这样的东西。

But you can do a two stage search.但是您可以进行两阶段搜索。

First go to AbstractProcessor class, put the cursor on the classname and open Find usage setting dialog (don't know the default keyboard shortcut).首先进入AbstractProcessor类,将光标放在类名上并打开Find usage setting对话框(不知道默认的键盘快捷键)。 Just use Ctrl + Shift + a and type find usage setting .只需使用Ctrl + Shift + a并输入find usage setting

Select Derived classes only and Project and Libraries :仅选择Derived classesProject and Libraries 在此处输入图片说明

The search result should find every annotation processor in your project and project libraries.搜索结果应在您的项目和项目库中找到每个注释处理器。

After that, you open the processed annotation and put your cursor on the class name and open the file usage dialog again.之后,您打开已处理的注释并将光标放在类名上,然后再次打开文件使用对话框。

But this time you want to find every usages and you want to restrict the search on your previous search result:但是这一次你想找到每一个用法,并且你想限制对你以前的搜索结果的搜索: 在此处输入图片说明

The result should contain every annotation processor that uses your annotation candidate.结果应包含使用您的注释候选的每个注释处理器。 It's very likely, that it's only one.很有可能,只有一个。

This pattern can be used for every use case where you have a starting collection of files and want to refine/reduce the search result.此模式可用于您拥有初始文件集合并希望优化/减少搜索结果的每个用例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM