Find all *DTO
classes, that have a (at least one) public field that is neither @ApiModelProperty, nor a @JsonIgnore
-
Open
Edit->Find->Search structurally
-
Paste this into
Search template
field:class $Class$ { @$FieldAnnotation$ public $type$ $field$; }
-
Click
Edit Variables
:- for variable
Class
: provide a regex for a class name:.+DTO
- for variable
FieldAnnotation
:- Text/regexp:
ApiModelProperty|JsonIgnore
- Minimum count/Maximum count:
0
/0
- Text/regexp:
- for variable
-
Choose
Scope
(see here to define a scope) -
Click
Find
-
If you're happy with results, click
Save Template...
and provide a template name
-
Open
Edit->Find->Search structurally
-
Paste this into
Search template
field:class $className$ { public String $methodName$ (); }
-
Click
Edit Variables
:- for variable
Class
: provide a regex for a class name:.+DTO
- for variable
methodName
:- Text/regexp:
toString
- Minimum count/Maximum count:
0
/0
- Text/regexp:
- for variable
-
Choose
Scope
(see here to define a scope) -
Click
Find
-
If you're happy with results, click
Save Template...
and provide a template name
-
Open
Edit->Find->Replace structurally
-
Paste this into
Search template
field:map.put("$field$","$a$");
-
Paste this into
Replace template
field:map.put(FieldNames.$ENUMFIELD$, "$a$");
-
Click
Edit variables
:-
for variable
ENUMFIELD
, provideScript text
as follows:import static com.google.common.base.CaseFormat.LOWER_CAMEL as LOWER_CAMEL import static com.google.common.base.CaseFormat.UPPER_UNDERSCORE as UPPER_UNDERSCORE LOWER_CAMEL.to(UPPER_UNDERSCORE, field.getInnerText())
-
Click
OK
-
-
Click
Find
-
Check validity of the results and replace when necessary
- Open
Edit->Find->Replace structurally
- Paste this into
Search
field:@$MethodAnnotation$ public void $MethodName$(@mockit.Injectable $ParameterType$ $Parameter$) { $statement$; }
- Choose file type:
Java - Class Member
- Add filter for
MethodAnnotation
variable: Text=org.junit.jupiter.api.Test - Add Min=0 for
statement
andParameter
variables - Paste this into
Replace
field:(mind the indentation, otherwise it will be screwed!)@$MethodAnnotation$ void $MethodName$(@Injectable $ParameterType$ $Parameter$) { $statement$; }
- Select
Complete match
value forSearch target
- Find
NB: for some reason, I could not make it "parameter annotation" agnostic... that's why @Injectable
annotation is hardcoded in the template
- On a
Structural Search
window, click on ellipsis...
button next toScope
combobox - Click
+
button (Add Scope
) or pressIns
- In order to include only specific folder (with subfolders) in a search, put a construction into
Pattern
field:file[modulename]:src/main/java/com/my/package//*
- Open
Edit->Find->Search structurally
- Click
Existing templates
- Select necessary template and click
OK