如何在intelliJ中查找具有实现指定接口的类的所有字段? [英] How to find all fields having classes that implement specified interface in intelliJ?

查看:986
本文介绍了如何在intelliJ中查找具有实现指定接口的类的所有字段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 Disposable 界面查找所有字段,因此我可以知道是否忘记调用 dispose()清理阶段中任何一个的方法。

I'm trying to find all fields with the Disposable interface, so I can know if whether I forgot to call the dispose() method on any of them in the cleanup phase.

有没有办法在intelliJ中做到这一点?

Is there a way to do that in intelliJ?

我只是设法找到那些我已记得要调用的 dispose()方法。我已经通过勾选find usages选项对话框中的使用方法的用法复选框(当在 Disposable 界面上进行搜索时)来完成此操作...但这不是'我需要的是什么。

I've only managed to find those, whose dispose() methods I've already remembered to call. I've done that by ticking the "Usages of methods" checkbox in the find usages options dialog (when doing a search on the Disposable interface)... but this wasn't what I need.

推荐答案

你可以尝试编辑|找到|在结构上搜索。您可以通过删除Init部分并为$ FieldType $ variable指定层次结构约束来复制名为class of fields的预定义模板,该模板可以根据需要进行修改。

You can try Edit | Find | Search Structurally. You can copy a predefined template named "fields of class" that can be modified to your needs by removing Init part and specifying a hierarchy constraint for $FieldType$ variable.

您可以在 https://www.jetbrains上阅读有关该功能的更多信息。 com / idea / help / structural-search-and-replace.html

这篇关于如何在intelliJ中查找具有实现指定接口的类的所有字段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆