Using variables inside the search syntax ======================================== There are certain scenarios where we want to match parts of the code against other parts. For example, when we define a logger, we want to make sure that we pass the name of the current class. These recipes use variables in the search part. This document will describe the quickest way to write such recipes. Which variables are available? ------------------------------ The quickest way to list all available variables is to switch to the quick fix tab, and add a ``rewrite`` action. This will show a table below the input box with all the possible variables. All these variables can also be used inside the search portion. .. seealso:: Take a look at :doc:`/ref/templating` for how to manipulate the variables. Example ------- .. code-block:: yaml search: instanceCreation: args: 1: not: value: "{{{ containingClass.name }}}" type: "java.lang.String" type: "Logger" .. literalinclude:: src/advancedsearch.java :lines: 1-4 :language: java :emphasize-lines: 3