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


 一、文件級別的注釋

        主要是通過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 project

個人一般設置成

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

二、方法級別的注釋

基於Live Template
  基礎的Live Template
  psvm+tab,main方法
  iter+tab,foreach語句
  live template還有一個surround的用法,選中某個變量,鍵入ctl+alt+j兩次,則會出現自動補全的菜單
基本步驟
  1、點擊File--》Setting--》Editor→Live Template,點擊右側的+號,選擇Template Group
  2、輸入MyGroup(你也可以輸入其他自定義的名稱),然后點擊OK。
  3、選中MyGroup之后,再次點擊右側的+號,選擇Live Template
  4、點擊第四步的Define,選擇EveryWhere
  5、點擊右邊的Edit variables
  6、點擊OK,頁面任意地方輸入cmt,然后點擊回車,即可


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM