效果预览
类级注释
File -> Settings -> Editor -> File and Code Templates
/**
* @class ${NAME}
* @author ${USER}
* @date ${DATE} ${TIME}
* @version 1.0.0
* @description ${DESCRIPTION}
*/
触发方式:创建新类时自动触发
方法级注释
File -> Settings -> Editor -> Live Templates
**
* @method $methodName$
* @author $user$
* @date $date$ $time$
$param$
* @return $return$
* @description
*/
2021.07.12更新
**
$param$$return$
* @method $methodName$
* @author 吃猫的鱼℘, 935478677@qq.com
* @date $date$ $time$
*/
从上到下依次是:
methodName()
user()
date()
time()
param
groovyScript("if("${_1}".length() == 2) {return ' * @param';} else {def result='';def params="${_1}".replaceAll('[\\[|\\]|\\s]', '').split(',').toList();def paramsTypes="${_2}".replaceAll('[\\[|\\]|\\s]', '').split(',').toList();for(i = 0; i < params.size(); i++) {if(i<(params.size()-1)){result+=' * @param ' + params[i] + ' ' + paramsTypes[i] + '\n'}else{result+=' * @param ' + params[i] + ' ' + paramsTypes[i]}};return result;}", methodParameters(), methodParameterTypes());
return
groovyScript("def params="${_1}"; if(params=='void'){return 'void';} else {return params}", methodReturnType())
2021.07.12更新
param
groovyScript("if("${_1}".length() == 2) {return '';} else {def result='';def params="${_1}".replaceAll('[\\[|\\]|\\s]', '').split(',').toList();for(i = 0; i < params.size(); i++) {if(i<(params.size()-1)){result+=' * @param ' + params[i] + '\n\t'}else{result+=' * @param ' + params[i]}};return result;}", methodParameters();
return
groovyScript("def params="${_1}"; if(params=='void'){return '\r\n\t * @return void';} else if(params=='null'){return '';}else {return '\r\n\t * @return '+params}", methodReturnType());
触发方式:在方法前一行按/**+Enter