1、打开配置
setting -> Editor -> Live Template
2、添加TemplateGroup,并在添加的TemplateGroup下加LiveTemplate
3、配置Live Template
内容:
**** @Description: *
$param$* @return $return$ * @author $user$* @date $date$ $time$**/
变量:
param:
groovyScript("def result=''; def params=\"${_1}\".replaceAll('[\\\\[|\\\\]|\\\\s]', '').split(',').toList(); for(i = 0; i < params.size(); i++) {result+=' * @param ' + params[i] + ((i < params.size() - 1) ? '\\n':'')}; return result", methodParameters())
return:
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())
@throws暂时没找到
4、apply并且保存,在方法名上面输入/* 按回车
5、配置java类、接口、枚举等类注释
内容:
/*** @Description: $TODO** @author ${USER}* @date ${DATE} ${TIME}*/
创建类、枚举、接口、Record时会要求填写TODO,并添加注释