idea版本:2020.3.x
一、添加类注释模板(新建类自动生成) 1、打开idea,依次如下选择File–>settings–>Editor–>File and Code Templates–>Includes
3、效果图 二、添加方法注释模板 1、打开idea,依次如下选择
File–>Settings–>Editor–>Live Templates
2、新建组:MyGroup 3、新建方法注释模板 4、注释如下* * @description: * @author: xx * @date $date$ * @param $param$ * @return $returns$ * @throws $throws$ */
注意模板开头为:* ,不为 /**
5、编辑variables上图第9步:
groovyscript("def result=''; def params="${_1}".replaceAll('[\\[|\\]|\\s]', '').split(',').toList(); for(i = 0; i < params.size() - 1; i++) { if(params[i] == '') return result; if(i==0) result += params[i] + '\t' + '\n' ; result+=' * @param ' + params[i+1] + '\t' + ((i < params.size()-2) ? '\n' : '')}; return result", methodParameters())
5.2 说明
throws 暂时没有可自动获取值的方法,若有道友知道自动获取异常值的方法,欢迎评论区指教
6、效果图


