選擇 window-->Preferences-->JAVA-->Code-->Code Templates
選擇 Comments --> Files --> Edit
添加
/**
* Filename: ${file_name}
* Description:
* Copyright: Copyright (c)2009
* Company: company
* @author: alex
* @version: 1.0
* Create at: ${date} ${time}
*
* Modification History:
* Date Author Version Description
* ------------------------------------------------------------------
* ${date} alex 1.0 1.0 Version
*/
Modification History: 每次修改版本,需要添加修改記錄和說(shuō)明
將下面的 Automatically add comments for new methods and types 選中
選擇 Comments --> Methods --> Edit
添加
/**
* {方法的功能/動(dòng)作描述}
* @param {引入?yún)?shù)名} {引入?yún)?shù)說(shuō)明}
* @return {返回參數(shù)名} {返回參數(shù)說(shuō)明}
* @exception {說(shuō)明在某情況下,將發(fā)生什么異常}
*/
這樣在新增java類(lèi)文件時(shí),可以自動(dòng)加載注釋模板,生成后需要稍微調(diào)整一下注釋的位置。
對(duì)于方法注釋的添加,可以在要添加的注釋處,單擊右鍵 選擇 Source-->Generate Element Comment 即可生成方法注釋?zhuān)畛渥⑨寖?nèi)容