zoukankan      html  css  js  c++  java
  • idea 模版之自定义类与方法注释

    idea 模版之自定义类与方法注释

    很多公司都有要求的代码注释规范,我们每新建类或者方法的时候从新复制粘贴很麻烦,而且容易粘错。
    当然自定义模板还可以用到很多地方,比如系统自带的 sout就是system.out.print(); 当你输入某文本的时候,系统会自动替换成目标文本。

    首先介绍一下类模板

    不只是java类,所有支持的文件头都可以自定义

    File -- Settings -- Editor -- Code Style -- File and Code Templates

    将对应文本替换就可以了,根据自己需求。 这些变量在Descriptions里面有定义 我先粘出来方便查找吧。

    ${PACKAGE_NAME}
    
    name of the package in which the new file is created
    ${NAME}
     
    name of the new file specified by you in the New <TEMPLATE_NAME> dialog
    
    ${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
    

    但是这个暂时不知道怎么修改。

    然后就是方法模板

    其实就是文本替换,也很简单

    settings > live templates

    abbreviation 就是缩写 比如sout。
    底下的是作用域,这里面的变量又不一样, 点击右侧 Edit variables可以编辑

    其实是很多函数。 这个有需求的自己去查一查吧。

  • 相关阅读:
    毕设进度2020.02.06
    毕设进度2020.02.05
    毕设进度2020.02.04
    学习进度2020.02.03
    学习进度2020.02.02
    学习进度2020.02.01
    毕设之路:本周计划(五)2019.11.18——2019.11.23
    毕设之路:本周计划(四)2019.11.11——2019.11.17
    洛谷P2015 二叉苹果树
    洛谷P1131 [ZJOI2007]时态同步
  • 原文地址:https://www.cnblogs.com/novaCN/p/6417330.html
Copyright © 2011-2022 走看看