Window → Preferences → Java → Code Style → Code Templates → 展開 Comments 節點,逐項編輯下列模板。
/**
* FileName: ${file_name}
* @Description: ${todo}
* @author: ${user}
* @version V1.0
* Createdate: ${date} ${time}
* Copyright: Copyright(C) ${year}-${year+1}
* Company: ${company}
* All rights Reserved, Designed By ${author}
* Modification History:
* Date Author Version Description
* -----------------------------------------------------------------------
* ${date} ${user} 1.0 1.0
* Why & What is modified:
*/
/**
* @ClassName: ${type_name}
* @Description: ${todo}
* @author: ${user}
* @date: ${date} ${time}
*/
/**
* @Fields ${field} : ${todo}
*/
/**
* @Title: ${enclosing_type}
* @Description: ${todo}
* @param: ${tags}
* @throws
*/
/**
* @Title: ${enclosing_method}
* @Description: ${todo}
* @param: ${tags}
* @return: ${return_type}
* @throws
*/
/**
* <p>Title: ${enclosing_method}</p>
* <p>Description: </p>
* ${tags}
* ${see_to_overridden}
*/
/**
* ${tags}
* ${see_to_target}
*/
/**
* @Title: ${enclosing_method} <BR>
* @Description: ${todo} <BR>
* @return: ${field_type} <BR>
*/
/**
* @Title: ${enclosing_method} <BR>
* @Description: ${todo} <BR>
* @param: ${tags}
*/
${todo}:光標自動定位處,便於填寫業務描述。${user}/${date}/${time}:自動填充系統用戶名/日期/時間。${tags}:自動展開為所有參數的 @param 標簽。${see_to_overridden}/${see_to_target}:自動生成 @see 引用父類/目標方法。eclipse.ini 中配置 -Duser.name=xxx -Dcompany=xxx 統一管理。File → Export → Java → Code Style → Code Templates 導出 .xml,納入項目代碼規範倉庫,新成員一鍵導入。Preferences → Java → Editor → Save Actions → Additional actions → Configure → Code Style → Add missing Javadoc tags,保存自動補全缺失標簽。