Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use Intellij Structural Search to find all methods that use two named classes?

Say I have two Java classes, TradeType and InstrumentType. I know that somewhere in my codebase there is a method that maps from TradeType to InstrumentType.

How can I use Structural Search in Intellij to say

"find me all methods that have a single parameter of type TradeType and which return InstrumentType"

like image 700
Mike Hogan Avatar asked Feb 26 '13 12:02

Mike Hogan


1 Answers

Search template:

class $Class$ { 
    InstrumentType $MethodName$(TradeType $Parameter$);
}

Then click Edit variables..., and set the following for the MethodName variable:

  • Occurrences count: Unlimited
  • This variable is target of the search

Also pay attention to what the scope of the search is.

like image 76
zagyi Avatar answered Oct 29 '22 02:10

zagyi