1. Configuration class annotation
click setting
method one:
1. Add the template in the picture below as required
/**
* @Author: aaa
* @Date: ${YEAR}/${MONTH}/${DAY}
* @Description:
*/
2. Check the two ticks below and click apply
Method Two:
We saw such a sentence in the template just now
This sentence means that the header of File header.Java will be automatically introduced when the project is created. This header is shown in the figure below
Note that you can use one of the two methods, otherwise we will have two repeated comments when creating the class,
The effect after correct configuration is as follows
2. Add method annotations
Add a group and name it
Then select the newly created group, then click the + sign in the upper right corner and select Live Template
Fill in the information according to the figure below. It is best to choose the same as me in the first box, which is a *, so that the operation will be more convenient later. The second box is to fill in the description information casually
template text content,
*
* $var1$
$params$ * @return $returns$
* @author $user$
* @description TODO
* @date $date$ $time$
*/
fill in var1
groovyScript(" def result=''; def params=\"${_1}\".replaceAll('[\\\\[|\\\\]|\\\\s]', '').split(',').toList(); for(i = 0; i < params.size(); i++) { if(i!=0)result+= ' * '; result+='@param ' + params[i] + ': ' + ((i < (params.size() - 1)) ? '\\n' + '\\t' : ''); }; return result", methodParameters())
fill in returns
groovyScript("def result=''; def params=\"${_1}\".replaceAll('[\\\\[|\\\\]|\\\\s]', '').split('<').toList(); for(i = 0; i < params.size(); i++) {if(i!=0){result+='<';}; def p1=params[i].split(',').toList(); for(i2 = 0; i2 < p1.size(); i2++) { def p2=p1[i2].split('\\\\.').toList(); result+=p2[p2.size()-1]; if(i2!=p1.size()-1){result+=','} } ; }; return result", methodReturnType())
Can be fine-tuned according to your needs