Eclipse注釋模板設置詳解

設置注釋模板的入口:Window->Preference->Java->Code Style->Code Template 然后展開Comments節(jié)點就是所有需設置注釋的元素醉锄。本文現(xiàn)就每一個元素逐一給大家介紹一下最筒。

文件(Files)注釋標簽:

[html]?view plain?copy

/**??

*?@Title:?${file_name}??

*?@Package?${package_name}??

*?@Description:?${todo}(用一句話描述該文件做什么)??

*?@author?${user}??

*?@date?${date}??

*?@version?V1.0??

*/??

類型(Types)注釋標簽(類的注釋):

[html]?view plain?copy

/**??

*?@ClassName:?${type_name}??

*?@Description:?${todo}(這里用一句話描述這個類的作用)??

*?@author?${user}??

*?@date?${date}??

*??

*?${tags}??

*/??

字段(Fields)注釋標簽:

[html]?view plain?copy

/**??

*?@Fields?field:field:{todo}(用一句話描述這個變量表示什么)??

*/??


構(gòu)造函數(shù)(Constructor)標簽:

[html]?view plain?copy

/**??

*?創(chuàng)建一個新的實例?${enclosing_type}.??

*??

*?${tags}??

*/??

方法(Methods)標簽:

[html]?view plain?copy

/**??

*?@Title:?${enclosing_method}??

*?@Description:?${todo}(這里用一句話描述這個方法的作用)??

*?@param?${tags}????參數(shù)??

*?@return?${return_type}????返回類型??

*?@throws??

*/??

覆蓋方法(Overriding Methods)標簽:

[html]?view plain?copy

/*?(非?Javadoc)??

*

Title:?${enclosing_method}


*

Description:?


*?${tags}??

*?${see_to_overridden}??

*/??

代理方法(Delegate Methods)標簽:

[html]?view plain?copy

/**??

*?${tags}??

*?${see_to_target}??

*/??

getter方法標簽:

[html]?view plain?copy

/**??

*?@return?${bare_field_name}??

*/??


setter方法標簽:

[html]?view plain?copy

/**??

*?@param?paramtheparamthe{bare_field_name}?to?set??

*/??

要實現(xiàn)上面的注釋模板盯荤,這需要將下面的配置文件導入就可以了:

[html]?view plain?copy



autoinsert="false"??

context="filecomment_context"??

deleted="false"??

description="Comment?for?created?Java?files"??

enabled="true"??

id="org.eclipse.jdt.ui.text.codetemplates.filecomment"??

name="filecomment">??

????/**????

????*?@Title:?${file_name}??

????*?@Package?${package_name}??

????*?@Description:?${todo}(用一句話描述該文件做什么)??

????*?@author?${user}??

????*?@date?${date}??

????*?@version?V1.0????

????*/??


autoinsert="false"??

context="typecomment_context"??

deleted="false"??

description="Comment?for?created?types"??

enabled="true"??

id="org.eclipse.jdt.ui.text.codetemplates.typecomment"??

name="typecomment">??

????/**??

????*?@ClassName:?${type_name}??

????*?@Description:?${todo}(這里用一句話描述這個類的作用)??

????*?@author?${user}??

????*?@date?${date}??

????*??

????*?${tags}??

????*/??


autoinsert="false"??

context="fieldcomment_context"??

deleted="false"??

description="Comment?for?fields"??

enabled="true"??

id="org.eclipse.jdt.ui.text.codetemplates.fieldcomment"??

name="fieldcomment">??

????/**??

????*?@Fields?field:field:{todo}(用一句話描述這個變量表示什么)??

????*/??


autoinsert="false"??

context="constructorcomment_context"??

deleted="false"??

description="Comment?for?created?constructors"??

enabled="true"??

id="org.eclipse.jdt.ui.text.codetemplates.constructorcomment"??

name="constructorcomment">??

????/**??

?????*?創(chuàng)建一個新的實例?${enclosing_type}.??

?????*??

?????*?${tags}??

?????*/??


autoinsert="false"??

context="methodcomment_context"??

deleted="false"??

description="Comment?for?non-overriding?methods"??

enabled="true"??

id="org.eclipse.jdt.ui.text.codetemplates.methodcomment"??

name="methodcomment">??

????/**??

????*?@Title:?${enclosing_method}??

????*?@Description:?${todo}(這里用一句話描述這個方法的作用)??

????*?@param?${tags}????參數(shù)??

????*?@return?${return_type}????返回類型??

????*?@throws??

????*/??


autoinsert="true"??

context="overridecomment_context"??

deleted="false"??

description="Comment?for?overriding?methods"??

enabled="true"??

id="org.eclipse.jdt.ui.text.codetemplates.overridecomment"??

name="overridecomment">??

????/*?(非?Javadoc)??

*

Title:?${enclosing_method}


*

Description:?


????*?${tags}??

????*?${see_to_overridden}??

????*/??


autoinsert="true"??

context="delegatecomment_context"??

deleted="false"??

description="Comment?for?delegate?methods"??

enabled="true"??

id="org.eclipse.jdt.ui.text.codetemplates.delegatecomment"??

name="delegatecomment">??

????/**??

?????*?${tags}??

?????*?${see_to_target}??

?????*/??


autoinsert="false"??

context="gettercomment_context"??

deleted="false"??

description="Comment?for?getter?method"??

enabled="true"??

id="org.eclipse.jdt.ui.text.codetemplates.gettercomment"??

name="gettercomment">??

????/**??

????*?@return?${bare_field_name}??

????*/??


autoinsert="true"??

context="settercomment_context"??

deleted="false"??

description="Comment?for?setter?method"??

enabled="true"??

id="org.eclipse.jdt.ui.text.codetemplates.settercomment"??

name="settercomment">??

????/**??

?????*?@param?paramtheparamthe{bare_field_name}?to?set??

?????*/??

/* 確定一個系統(tǒng)的學習Java的計劃,如果想自學锰镀,那么你就找一套非常系統(tǒng)的學習視頻。如果你自己找不到系統(tǒng)的學習視頻≌两幔可以加下小編的Java學習群:557865078,編號(煙火)不管你是小白還是大牛琼开,小編我都歡迎易结,不定期分享干貨,包括小編自己整理的一份2018最新的Java學習資料和0基礎入門教程柜候,歡迎初學和進階中的小伙伴搞动。*/

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市渣刷,隨后出現(xiàn)的幾起案子鹦肿,更是在濱河造成了極大的恐慌,老刑警劉巖飞主,帶你破解...
    沈念sama閱讀 221,820評論 6 515
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件狮惜,死亡現(xiàn)場離奇詭異,居然都是意外死亡碌识,警方通過查閱死者的電腦和手機碾篡,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 94,648評論 3 399
  • 文/潘曉璐 我一進店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來筏餐,“玉大人开泽,你說我怎么就攤上這事】桑” “怎么了穆律?”我有些...
    開封第一講書人閱讀 168,324評論 0 360
  • 文/不壞的土叔 我叫張陵,是天一觀的道長导俘。 經(jīng)常有香客問我峦耘,道長,這世上最難降的妖魔是什么旅薄? 我笑而不...
    開封第一講書人閱讀 59,714評論 1 297
  • 正文 為了忘掉前任辅髓,我火速辦了婚禮,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘洛口。我一直安慰自己矫付,他們只是感情好,可當我...
    茶點故事閱讀 68,724評論 6 397
  • 文/花漫 我一把揭開白布第焰。 她就那樣靜靜地躺著买优,像睡著了一般。 火紅的嫁衣襯著肌膚如雪挺举。 梳的紋絲不亂的頭發(fā)上杀赢,一...
    開封第一講書人閱讀 52,328評論 1 310
  • 那天,我揣著相機與錄音豹悬,去河邊找鬼葵陵。 笑死,一個胖子當著我的面吹牛瞻佛,可吹牛的內(nèi)容都是我干的脱篙。 我是一名探鬼主播,決...
    沈念sama閱讀 40,897評論 3 421
  • 文/蒼蘭香墨 我猛地睜開眼伤柄,長吁一口氣:“原來是場噩夢啊……” “哼绊困!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起,我...
    開封第一講書人閱讀 39,804評論 0 276
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎春寿,沒想到半個月后,有當?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體取视,經(jīng)...
    沈念sama閱讀 46,345評論 1 318
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 38,431評論 3 340
  • 正文 我和宋清朗相戀三年常挚,在試婚紗的時候發(fā)現(xiàn)自己被綠了作谭。 大學時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 40,561評論 1 352
  • 序言:一個原本活蹦亂跳的男人離奇死亡奄毡,死狀恐怖折欠,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情吼过,我是刑警寧澤锐秦,帶...
    沈念sama閱讀 36,238評論 5 350
  • 正文 年R本政府宣布,位于F島的核電站盗忱,受9級特大地震影響酱床,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜趟佃,卻給世界環(huán)境...
    茶點故事閱讀 41,928評論 3 334
  • 文/蒙蒙 一斤葱、第九天 我趴在偏房一處隱蔽的房頂上張望慷垮。 院中可真熱鬧,春花似錦揍堕、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 32,417評論 0 24
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至贮泞,卻和暖如春楞慈,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背啃擦。 一陣腳步聲響...
    開封第一講書人閱讀 33,528評論 1 272
  • 我被黑心中介騙來泰國打工囊蓝, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留,地道東北人令蛉。 一個月前我還...
    沈念sama閱讀 48,983評論 3 376
  • 正文 我出身青樓聚霜,卻偏偏與公主長得像,于是被迫代替她去往敵國和親珠叔。 傳聞我的和親對象是個殘疾皇子蝎宇,可洞房花燭夜當晚...
    茶點故事閱讀 45,573評論 2 359

推薦閱讀更多精彩內(nèi)容

  • 設置注釋模板的入口: Window->Preference->Java->Code Style->Code Tem...
    柒黍閱讀 656評論 0 0
  • 例如: /** * @param * @return */ 快捷鍵為:ALT + SHIFT +J 想更換為其他的...
    寶貝雙雙閱讀 2,343評論 0 0
  • Spring Cloud為開發(fā)人員提供了快速構(gòu)建分布式系統(tǒng)中一些常見模式的工具(例如配置管理,服務發(fā)現(xiàn)祷安,斷路器姥芥,智...
    卡卡羅2017閱讀 134,702評論 18 139
  • =========================================================...
    lavor閱讀 3,494評論 0 5
  • 各種的擔心害怕阻止著前進的步伐,害怕一臉的幼稚汇鞭,智障的套路凉唐,浪費無辜的時間而得不到該有的享受與快樂。卻又好奇并...
    米小勒_28e5閱讀 215評論 0 0