美文网首页
Idea设置类注释和方法注释模板

Idea设置类注释和方法注释模板

作者: SunnyMore | 来源:发表于2018-05-15 16:22 被阅读438次

    设置类注释

    1. Ctrl + Alt + S
    2. Editor -> File and Code Templates -> Includes
    3. 新增加一个File Header
    4. 配置如下:
    /**
     * <Description> <br>
     * 
     * @author Sunny<br>
     * @taskId:   <br>
     * @version 1.0<br>
     * @createDate ${YEAR}/${MONTH}/${DAY} ${TIME} <br>
     * @see ${PACKAGE_NAME} <br>
     */
    

    Idea 支持的变量

    This is a built-in template. It contains a code fragment that can be included into file templates (Templates tab) with the help of the #parse directive.
    The template is editable. Along with static text, code and comments, you can also use predefined variables that will then be expanded like macros into the corresponding values.
    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
    ${HOUR}     current hour
    ${MINUTE}       current minute
    ${PROJECT_NAME}     the name of the current project
    

    设置方法注释

    1. Ctrl + Alt + S
    2. Editor -> Live Templates
    3. 新增一个Template Group,如图


      image.png
    4. 新增一个mc的live template,如图


      image.png
    5. 具体模板,如下:
    /**
    * Description <br> 
    * 
    * @author Sunny <br>
    * @taskId <br>
    * @param $METHOD_PARAM$ <br>
    * @createDate $Date$ $Time$<br>
    **/
    
    image.png

    相关文章

      网友评论

          本文标题:Idea设置类注释和方法注释模板

          本文链接:https://www.haomeiwen.com/subject/noqydftx.html