2020-09-08  10:16:17  by冲冲

 

1.头注释

①设置

【IDEA】头注释和方法注释

②模板内容

/**
 * @ClassName ${NAME}
 * @Description ${DESCRIPTION}
 * @Author guochong.ye
 * @Date ${YEAR}/${MONTH}/${DAY}/${TIME}
 */

③结果

【IDEA】头注释和方法注释

 

2.方法注释

①创建模板

【IDEA】头注释和方法注释

②设置模板

【IDEA】头注释和方法注释

模板内容

*
 * @Description $description$
$params$
 * @return $returns$
 * @Author guochong.ye
 * @Date $date$/$time$
 */

③设置变量

【IDEA】头注释和方法注释

@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())

@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())

④IDEA设置注释配置时获取不到参数的解决办法

1.1 param参数配置如上

1.2 模板内容开头不要带“/*

【IDEA】头注释和方法注释

1.3 将模板名称设置为“*”,取模板的时候使用"/**" + "Enter"键

⑤结果

【IDEA】头注释和方法注释

 

相关文章:

  • 2021-10-05
  • 2022-01-05
  • 2021-09-27
  • 2021-07-12
猜你喜欢
  • 2022-12-23
  • 2021-10-04
  • 2021-07-07
  • 2022-01-05
  • 2021-12-16
  • 2021-04-23
相关资源
相似解决方案