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可以编辑

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

  • 相关阅读:
    OI竞赛常见错误总结
    lis最长上升子序列o(nlogn)优化
    链表及其简单应用
    栈及其简单应用
    哈希表Hash:概念与基本操作
    队列及其简单应用
    poj1418 Viva Confetti 判断圆是否可见
    poj1981 Circle and Points 单位圆覆盖问题
    poj2187 Beauty Contest(旋转卡壳)
    poj2932 Coneology (扫描线)
  • 原文地址:https://www.cnblogs.com/novaCN/p/6417330.html
Copyright © 2011-2022 走看看