Java-idea-設置類頭註釋和方法註釋

 1、文件級別的註釋

        主要是經過File--》Setting--》Editor→File and Code Template中來設置
    能夠再右側include中設置File Header
  可設置值:

Predefined variables will take the following values:
${PACKAGE_NAME}name of the package in which the new file is created
${USER}current user system login name
${DATE}current system date
${TIME}current system time
${YEAR}current year
${MONTH}current month
${MONTH_NAME_SHORT}first 3 letters of the current month name. Example: Jan, Feb, etc.
${MONTH_NAME_FULL}full name of the current month. Example: January, February, etc.
${DAY}current day of the month
${DAY_NAME_SHORT}first 3 letters of the current day name. Example: Mon, Tue, etc.
${DAY_NAME_FULL}full name of the current day. Example: Monday, Tuesday, etc.
${HOUR}current hour
${MINUTE}current minute
${PROJECT_NAME}the name of the current projectide

我的通常設置成idea

/**
*
* @author ${USER}
* @since ${DATE} ${TIME}
*/blog

2、方法級別的註釋

基於Live Template
  基礎的Live Template
  psvm+tab,main方法
  iter+tab,foreach語句
  live template還有一個surround的用法,選中某個變量,鍵入ctl+alt+j兩次,則會出現自動補全的菜單
基本步驟
  一、點擊File--》Setting--》Editor→Live Template,點擊右側的+號,選擇Template Group
  二、輸入MyGroup(你也能夠輸入其餘自定義的名稱),而後點擊OK。
  三、選中MyGroup以後,再次點擊右側的+號,選擇Live Template
  四、點擊第四步的Define,選擇EveryWhere
  五、點擊右邊的Edit variables
  六、點擊OK,頁面任意地方輸入cmt,而後點擊回車,便可
相關文章
相關標籤/搜索