在 IDEA 中,安装 JavaDoc2 规范
Other Setting - JavaDoc2 - Templates
按照要求,替换模板为下面的类容。
其中 @author ZhangSan
需要使用 @author 骆驼规则的拼音
代替
#^.(public|protected|private).+interface\s+\w+.*
修改 前 5 行
/**\n
* <p> \n
* The interface ${name}.\n
* \n
* @author ZhangSan \n
* @date ${.now?string["yyyy-MM-dd"]} \n
*
<#if element.typeParameters?has_content> * \n
</#if>
<#list element.typeParameters as typeParameter>
* @param <${typeParameter.name}> the type parameter\n
</#list>
*/
#^.(public|protected|private).+enum\s+\w+.*
修改 前 5 行
/**\n
* <p> \n
* The enum ${name}.\n
* \n
* @author ZhangSan
* @date ${.now?string["yyyy-MM-dd"]} \n
*/
#^.(public|protected|private).+class\s+\w+.*
修改 前 5 行
/**\n
* <p> \n
* The type ${name}.\n
* \n
* @author ZhangSan \n
* @date ${.now?string["yyyy-MM-dd"]} \n
*
<#if element.typeParameters?has_content> * \n
</#if>
<#list element.typeParameters as typeParameter>
* @param <${typeParameter.name}> the type parameter\n
</#list>
*/
/**\n
* <p> \n
* The type ${name}.\n
* \n
* @author ZhangSan \n
* @date ${.now?string["yyyy-MM-dd"]} \n
*/
#^.(public|protected|private)\s*.(\w(\s<.+>))+\s+get\w+\s(.*).+
修改 后 4 行
/**\n
* Gets ${partName}.\n
<#if element.typeParameters?has_content> * \n
</#if>
<#list element.typeParameters as typeParameter>
* @param <${typeParameter.name}> the type parameter\n
</#list>
<#if element.parameterList.parameters?has_content>
*\n
</#if>
<#list element.parameterList.parameters as parameter>
* @param ${parameter.name} the ${paramNames[parameter.name]}\n
</#list>
<#if isNotVoid>
*\n
*\n
* @return the ${partName}\n
</#if>
<#if element.throwsList.referenceElements?has_content>
*\n
</#if>
<#list element.throwsList.referenceElements as exception>
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
</#list>
* \n
* @author ZhangSan \n
* @date ${.now?string["yyyy-MM-dd HH:mm:ss"]} \n
*/
#^.(public|protected|private)\s*.(void|\w(\s<.+>))+\s+set\w+\s(.*).+
修改 后 4 行
/**\n
* Sets ${partName}.\n
<#if element.typeParameters?has_content> * \n
</#if>
<#list element.typeParameters as typeParameter>
* @param <${typeParameter.name}> the type parameter\n
</#list>
<#if element.parameterList.parameters?has_content>
*\n
</#if>
<#list element.parameterList.parameters as parameter>
* @param ${parameter.name} the ${paramNames[parameter.name]}\n
</#list>
<#if isNotVoid>
*\n
*\n
* @return the ${partName}\n
</#if>
<#if element.throwsList.referenceElements?has_content>
*\n
</#if>
<#list element.throwsList.referenceElements as exception>
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
</#list>
* \n
* @author ZhangSan \n
* @date ${.now?string["yyyy-MM-dd HH:mm:ss"]} \n
*/
#^.((public\s+static)|(static\s+public))\s+void\s+main\s(\sString\s([\s*\]|/./..)\s+\w+\s*).+
修改 后 4 行
/**\n
* The entry point of application.\n
<#if element.parameterList.parameters?has_content>
*\n
</#if>
* @param ${element.parameterList.parameters[0].name} the input arguments\n
<#if element.throwsList.referenceElements?has_content>
*\n
</#if>
<#list element.throwsList.referenceElements as exception>
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
</#list>
* \n
* @author ZhangSan \n
* @date ${.now?string["yyyy-MM-dd HH:mm:ss"]} \n
*/
#+.
/**\n
* ${name}<#if isNotVoid> ${return}</#if>.\n
<#if element.typeParameters?has_content> * \n
</#if>
<#list element.typeParameters as typeParameter>
* @param <${typeParameter.name}> the type parameter\n
</#list>
<#if element.parameterList.parameters?has_content>
*\n
</#if>
<#list element.parameterList.parameters as parameter>
* @param ${parameter.name} the ${paramNames[parameter.name]}\n
</#list>
<#if element.typeParameters?has_content> * \n
</#if>
<#if isNotVoid>
* \n
* @return the ${return}\n
</#if>
<#if element.throwsList.referenceElements?has_content>
*\n
</#if>
<#list element.throwsList.referenceElements as exception>
* @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n
</#list>
* \n
* @author ZhangSan \n
* @date ${.now?string["yyyy-MM-dd HH:mm:ss"]} \n
*/