0. 目录
类注释0. 方法头部注释 模板1. if 模板2.if else 模板3.for 模板4.for-list-string 模板5.for-i 模板6.修改代码注释模板7.create-xml 创建xml注释模板8.map-entryset模板9.map-iterator模板10.map-key模板11.map-value模板
上一篇《IntelliJ IDEA生成类注释和方法注释》
类注释
0. 方法头部注释 模板
**
* 用一句话描述方法
$param$
* @author lu
* @date $date$
* @
throws Exception
* @
return $
return$
* @version 1.0
*/
在
p
a
r
a
m
param
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())
注意:去掉斜杠“/” 快捷键:/
1. if 模板
if (true) {
}
2.if else 模板
if (true) {
}
else {
}
3.for 模板
for ( ) {
}
4.for-list-string 模板
List
<String> list
= new ArrayList<String>();
for (String s
: list
) {
}
5.for-i 模板
for (int i
= 0; i
< 10; i
++) {
}
6.修改代码注释模板
快捷键:update
7.create-xml 创建xml注释模板
快捷键:create-xml
8.map-entryset模板
Map
<String,String> map
= new HashMap<String,String>();
for(Map
.Entry
<String, String> entry
: map
.entrySet()){
String mapKey
= entry
.getKey();
String mapValue
= entry
.getValue();
System
.out
.println(mapKey
+":"+mapValue
);
}
快捷键:map-entryset
9.map-iterator模板
Iterator
<Entry
<String, String>> entries
= map
.entrySet().iterator();
while(entries
.hasNext()){
Entry
<String, String> entry
= entries
.next();
String key
= entry
.getKey();
String value
= entry
.getValue();
System
.out
.println(key
+":"+value
);
}
快捷键:map-iterator
10.map-key模板
Map
<String,String> map
= new HashMap<String,String>();
for(String key
: map
.keySet()){
System
.out
.println(key
);
}
快捷键:map-key
11.map-value模板
Map
<String,String> map
= new HashMap<String,String>();
for(String value
: map
.values()){
System
.out
.println(value
);
}
快捷键:map-value