IDEA方法注释模板
2022-01-06 20:26:13 1075
设置tab键触发
注释模板内容
**
* <p>$methodName$</p>
*$param$ $return$
* @Title $methodName$
* @author kyaa
* @date $date$ $time$
*/
变量填充
param
自己脚本模拟
def result = '';
def params = '[a, b]'.replaceAll('[\\[|\\]|\\s]', '').split(',').toList();
if (params.size() == 1 && ( params[0] == null || params[0] == 'null' || params[0] == '') ) {
return result;
};
def size = params.size();
if (size >= 1) {
result += '\r\n ';
};
for ( i = 0; i < size; i++) {
if (size > 1) {
result += ((i < size - 1) ? ' * @param ' + params[i] + '\r\n' : ' * @param ' + params[i])
} else {
result += ' * @param ' + params[i]
}
};
return result;
groovyScript("def result = ''; def params = \"${_1}\".replaceAll('[\\\\[|\\\\]|\\\\s]', '').split(',').toList(); if (params.size() == 1 && ( params[0] == null || params[0] == 'null' || params[0] == '') ) { return result; }; def size = params.size(); if (size >= 1) { result += '\\r\\n '; }; for ( i = 0; i < size; i++) { if (size > 1) { result += ((i < size - 1) ? ' * @param ' + params[i] + '\\r\\n' : ' * @param ' + params[i]) } else { result += ' * @param ' + params[i] } }; return result;", methodParameters())
return
自己脚本模拟
def data = 'java.lang.String';
if ( data == null || data == 'null' || data == '' || data == 'void' ) {
return '';
};
return '\r\n * @return ' + data;
groovyScript("def data = \"${_1}\"; if ( data == null || data == 'null' || data == '' || data == 'void' ) { return ''; }; return '\\r\\n * @return ' + data;", methodReturnType())