簡體   English   中英

在Intellij IDEA中,找到實現接口但不擴展另一個類的類

[英]In Intellij IDEA, find classes that implement an interface but do not extend another class

在Intellij IDEA中使用結構化搜索,如果我想查找實現接口但不擴展另一個類的所有類,應該如何使用搜索模板? 模板分別是:

class $Class$ implements $Interface$ {}

class $Class$ extends $Parent$ {}

分別設置最小和最大1,1和0,0。

我嘗試了與此問題類似的嘗試,但未成功:

IntelliJ結構搜索以查找實現A但不實現B的類

您可以結合使用兩個模板:

class $Class$ extends $Parent$ implements $Interface$ {}

使用以下變量設置

$Parent$
Text / regexp Excluded並啟用“ Apply constrains in type hierarchy ,最小/最大0,0
$Interface$
Included text / regexp,並啟用Apply constrains in type hierarchy ,最小/最大1,1

當我在以下測試代碼上使用這些設置進行搜索時,將找到BE

class Excluded {}
interface Included {}
class A extends Excluded implements Included {}
class B implements Included {}
class C extends Excluded {}
class D extends A {}
class E extends B {}
class F {}

當然,您需要使用自己的類和接口名稱,而不是“包含”和“排除”。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM