java类的注释模板_IDEA添加Java类注释模版的方法
本文介绍了idea添加java类注释模版的方法,分享给大家,具体如下:
idea版本:intellij idea 2017.2.5 x64
eclipse能在类上方输入/**,回车添加类注释模版,但idea没有默认添加这个功能,需要做一些设置。下面介绍三种方法实现:
创建类默认添加类注释
手动添加类注释
批量添加javadoc注释
一、设置新建类默认添加注释
依次点击setting|editor|file and code templates,添加如图配置
例子:
/**
*describe:
*
*@author xxx
*@date ${year}/${month}/${day}
*/
支持的变量在描述内,找到需要配置即可!
二、利用live template手动添加注释模版
依次点击setting|editor|live templates
1、点击+添加templates group,如my live templates
2、点击+添加live templates,修改abbreviation,再添加模版内容,模版变量以$var$格式定义,如
/**
*describe:
*
*@author xxx
*@date $date$
*/
3. 点击define定义模版作用范围,选择java
4. 点击edit variables定义变量,表达式解释见附件
5. 保存后,在类任意位置输入cc即可添加模版
三、批量添加注释
安装javadoc插件,alt+insert即可批量添加注释,包括所有类和方法,但是不能定制化,注释都是固定的。
附件
item
description
annotated("annotation qname")
creates a symbol of type with an annotation that resides at the specified location. for an example, see live templates in the iterations group.
arrayvariable()
suggests all array variables applicable in the current scope. for an example, see live templates in the iterations group.
anonymoussuper()
suggests a supertype for a kotlin object expression.
camelcase(string)
returns the string passed as a parameter, converted to camel case. for example, my-text-file/my text file/my_text_file will be converted to mytextfile.
capitalize(string)
capitalizes the first letter of the name passed as a parameter.
capitalizeandunderscore(scamelcasename)
capitalizes the all letters of a camelcase name passed as a parameter, and inserts an underscore between the parts. for example, if the string passed as a parameter is foobar, then the function returns foo_bar.
casttoleftsidetype()
casts the right-side expression to the left-side expression type. it is used in the iterations group to have a single template for generating both raw-type and generics collections.
classname(sclassname)
returns the name of the current class (the class where the template is expanded).
classnamecomplete()
this expression substitutes for the class name completion at the variable position.
clipboard()
returns the contents of the system clipboard.
snakecase(string)
returns camelcase string out of snake_case string. for example, if the string passed as a parameter is foo_bar, then the function returns foobar.
complete()
this expression substitutes for the code completion invocation at the variable position.
completesmart()
this expression substitutes for the smart type completion invocation at the variable position.
componenttypeof ()
returns component type of an array. for example, see the live templates in the iterations group in the other group.
currentpackage()
returns the current package name.
date(sdate)
returns the current system date in the specified format.
by default, the current date is returned in the default system format. however, if you specify date format in double quotes, the date will be presented in this format:
decapitalize(sname)
replaces the first letter of the name passed as a parameter with the corresponding lowercase letter.
descendantclassenum()
shows the children of the class entered as a string parameter.
enum(scompletionstring1,scompletionstring2,...)
list of comma-delimited strings suggested for completion at the template invocation.
escapestring(sescapestring)
escapes the specified string.
expectedtype()
returns the type which is expected as a result of the whole template. makes sense if the template is expanded in the right part of an assignment, after return, etc.
filename(sfilename)
returns file name with extension.
filenamewithoutextension()
returns file name without extension.
firstword(sfirstword)
returns the first word of the string passed as a parameter.
groovyscript("groovy code")
returns groovy script with the specified code.
you can use groovyscript macro with multiple arguments. the first argument is a script text that is executed or a path to the file that contains a script. the next arguments are bound to _1, _2, _3, ..._nvariables that are available inside your script.
also, _editor variable is available inside the script. this variable is bound to the current editor.
guesselementtype ()
makes a guess on the type of elements stored in a java.util.collection. to make a guess, intellij idea tries to find the places where the elements were added to or extracted from the container.
iterablecomponenttype()
returns the type of an iterable component, such as an array or a collection.
iterablevariable()
returns the name of a variable that can be iterated.
linenumber()
returns the current line number.
lowercaseanddash(string)
returns lower case separated by dashes, of the string passed as a parameter. for example, the string myexamplename is converted to my-example-name.
methodname()
returns the name of the embracing method (where the template is expanded).
methodparameters()
returns the list of parameters of the embracing method (where the template is expanded).
methodreturntype()
returns the type of the value returned by the current method (the method within which the template is expanded).
qualifiedclassname()
returns the fully qualified name of the current class (the class where the template is expanded).
clear the shorten fq names check box.
rightsidetype()
declares the left-side variable with a type of the right-side expression. it is used in theiterations group to have a single template for generating both raw-type and generics collections.
snakecase(scamelcasetext)
returns snake_case string out of camelcase string passed as a parameter.
spaceseparated(string)
returns string separated with spaces out of camelcase string passed as a parameter. for example, if the string passed as a parameter is foobar, then the function returns foo bar.
subtypes(stype)
returns the subtypes of the type passed as a parameter.
suggestindexname()
suggests the name of an index variable. returns i if there is no such variable in scope, otherwise returns j if there is no such variable in scope, etc.
suggestvariablename()
suggests the name for a variable based on the variable type and its initializer expression, according to your code style settings that refer to the variable naming rules.
for example, if it is a variable that holds an element within iteration, intellij idea makes a guess on the most reasonable names, also taking into account the name of the container being iterated.
suggestfirstvariablename(sfirstvariablename)
doesn't suggest true, false, this, super.
time(ssystemtime)
returns the current system time.
typeofvariable(var)
returns the type of the variable passed as a parameter.
underscorestocamelcase(scamelcasetext)
returns the string passed as a parameter with camelhump letters substituting for underscores. for example, if the string passed as a parameter is foo_bar, then the function returns foobar.
underscorestospaces(sparameterwithspaces)
returns the string passed as a parameter with spaces substituting for underscores.
user()
returns the name of the current user.
variableoftype()
suggests all variables that may be assigned to the type passed as a parameter, for example variableoftype("java.util.vector"). if you pass an empty string ("") as a parameter, suggests all variables regardless of their types.
jsarrayvariable
returns javascript array name.
jsclassname()
returns the name of the current javascript class.
jscomponenttype
returns the javascript component type.
jsmethodname()
returns the name of the current javascript method.
jsqualifiedclassname
returns the complete name of the current javascript class.
jssuggestindexname
returns a suggested name for an index.
jssuggestvariablename
returns a suggested name for a variable.
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持萬仟网。
希望与广大网友互动??
点此进行留言吧!
相关文章:

POJ 2586 Y2K Accounting Bug(贪心)
题目连接:http://poj.org/problem?id2586 题意:某公司要统计全年盈利状况,对于每一个月来说,如果盈利则盈利S,如果亏空则亏空D。公司每五个月进行一次统计,全年共统计8次(1-5、2-6、3-7、4-8、5-9、6-10、…

【组队学习】10月份微信图文索引
10月份微信图文索引 一、组队学习相关 周报: Datawhale组队学习周报(第036周)Datawhale组队学习周报(第035周)Datawhale组队学习周报(第034周)Datawhale组队学习周报(第033周&…

java spring scope_如何在Spring中自定义scope的方法示例
大家对于 Spring 的 scope 应该都不会默认。所谓 scope,字面理解就是“作用域”、“范围”,如果一个 bean 的 scope 配置为 singleton,则从容器中获取 bean 返回的对象都是相同的;如果 scope 配置为prototype,则每次返…

学习ExtJS4 常用控件
ExtJS组件配置方式介绍 1.使用逗号分隔参数列表配置组件 首先来看一个简单的逗号分隔参数列表的例子。这个例子非常简单,它用来显示信息提示框。 2.使用Json对象配置组件 接下来看一个使用Json对象配置组件的例子,很多地方习惯性称之为配…

青少年编程竞赛交流群周报(第036周)
2021年10月31日(周日)晚20:00我们在青少年编程竞赛交流群开展了第三十六期直播活动。 一、直播内容 我们直播活动的主要内容如下: 讲解了上次测试中小朋友们做错的题目 Scratch青少年编程能力等级测试模拟题(四级)。…

中国电信打造“三朵云”战略 助力互联网+医疗发展
随着云计算、大数据的快速发展,全行业上云成为一个趋势,在健康医疗这个领域,应大势之趋,纷纷构建医疗云。近日,中国电信医疗云专区北京节点发布会在京顺利召开,会后北京电信副总经理项煌妹接受了中国IDC圈记…

python 数据类笔试题_一道 Python 类的笔试题详解
r {}class C(object):def __init__(self, a, b):self.a aself.b bif b a:orig super(C, cls)r[cls.instance] 1a C(1, a)b C(1, a)c C(1, b)l [a, b, c]for i in l:if i not in r:r[i] 1else:r[i] 1assert r[a] 2assert r[b] 2assert r[c] 1原题目要求如下&…

【优秀作业】粒子群算法(Python)
粒子群优化算法 一、概述 粒子群优化算法(Particle Swarm Optimization,PSO)的思想来源于对鸟捕食行为的模仿,最初,Reynolds.Heppner 等科学家研究的是鸟类飞行的美学和那些能使鸟群同时突然改变方向,分散…

警惕企业中的五种虚假执行力
第一种虚假执行力:无条件服从——只强调员工“服从”,不强调员工的智慧 很多人讲执行力,很喜欢强调员工的无条件服从。这种观念是OEM(代工生产)制造业时代的产物。实际上这是一种基于“规模制造”的虚假执行力,其本质是把人当成了…

真实记录疑似Linux病毒导致服务器 带宽跑满的解决过程
案例描述 由于最近我在重构之前的APP,需要和server端进行数据交互,发现有一个现象,那么就是隔1~2天总会发生获取数据超时的问题,而且必须要重启服务器才能解决。早在之前,我有留意到这个问题,但是由于这个服…

java集合总结_Java中集合总结
Java数组的长度是固定的,为了使程序能够方便地存储和操作数目不固定的一组数据,JDK类库提供了Java集合,这些集合类都位于java.util包中,但是与数组不同的是,集合中不能存放基本类型数据,而只能存放对象的引…

区块链基本解读
最近看着这个区块链,稍有新得,写下菜鸟自己的理解,希望大牛多多指点。 总体心得,如果互联网技术解决的是通讯问题的话,区块链技术解决的是信任问题。 下面举个日常例子:打赌 比如A和B赌石头是否为天然玉石&…

PDO防注入原理分析以及使用PDO的注意事项 (转)
我们都知道,只要合理正确使用PDO,可以基本上防止SQL注入的产生,本文主要回答以下两个问题: 为什么要使用PDO而不是mysql_connect? 为何PDO能防注入? 使用PDO防注入的时候应该特别注意什么? 一、为何要优先使用PDO? P…

LSGO软件技术团队招新 线下组队学习
团队招新 LSGO软件技术团队(Dreamtech算法组)成立于2010年09月,团队主要从事地理信息系统、管理信息系统、计算机视觉等领域的应用开发,团队同时具有培养学生的重要职能,毕业学生分布在IBM、百度、阿里、腾讯、京东、…

java spring 配置文件_[Java教程]Spring配置文件
[Java教程]Spring配置文件02016-03-19 00:00:08Spring配置文件是集成了Spring框架的项目的核心,引擎从哪里开始,中间都执行了哪些操作,小谈一下它的执行流程。容器先是加载web.接着是applicationContext.一种方法是加入ContextLoaderServlet这…
王子朝:一种高效且容错的方法用于协作车辆定位
王子朝是华北电力大学计算机系大四的学生,Dreamtech成员,参加了多期Dreamtech与Datawhale联合组织的组队学习活动,现保送西安电子科技大学深造。 这篇图文是他在线下组队学习时,为大家分享自己所看论文的总结。 希望参与我们组队…

python文件句柄_Python文件操作
classfile(object):def close(self): #real signature unknown; restored from __doc__关闭文件"""close() -> None or (perhaps) an integer. Close the file.Sets data attribute .closed to True. A closed file cannot be used forfurther I/O operation…

XML简单的增改删操作
XML文件的简单增改删,每一个都可以单独拿出来使用。 新创建XML文件,<?xmlversion"1.0"encoding"utf-8"?> <bookstore> <bookgenre"fantasy"ISBN"2-3631-4"> <title>Oberons Legacy&l…

javascript推荐书籍
WEB前端研发工程师,在国内算是一个朝阳职业,这个领域没有学校的正规教育,大多数人都是靠自己自学成才。本文主要介绍自己从事web开发以来(从大二至今)看过的书籍和自己的成长过程,目的是给想了解 JavaScript或者是刚接触JavaScrip…

【青少年编程竞赛交流】10月份微信图文索引
10月份微信图文索引 由于“组队学习”这个公众号的功能主要是组织Datawhale社群中的学习者们每个月的组队学习,所以,我另外新建了这个微信公众号“青少年编程竞赛交流”,在这个公众号上分享有关青少年编程方面的知识。如果大家需要就关注这个…

java 简单万年历_JAVA实现的简单万年历代码
本文实例讲述了JAVA实现的简单万年历。分享给大家供大家参考,具体如下:import java.util.Scanner;public class PrintCalendar {public static void main(String[] args) {int years 0;int month 0;int days 0;boolean isRun false;//從控制台輸入年…

mongoDB 入门指南、示例
http://www.cnblogs.com/hoojo/archive/2011/06/01/2066426.html mongoDB 入门指南、示例 上一篇:简单介绍mongoDB 一、准备工作 1、 下载mongoDB 下载地址:http://www.mongodb.org/downloads 选择合适你的版本 相关文档:http://www.mongodb.…

中国电子学会图形化四级编程题:成语接龙
「青少年编程竞赛交流群」已成立(适合6至18周岁的青少年),公众号后台回复【Scratch】或【Python】,即可进入。如果加入了之前的社群不需要重复加入。 我们将有关编程题目的教学视频已经发布到抖音号21252972100,小马老…

sidecar学习
1、SideCar的出现 微服务的结构是细粒度的,由多个服务构成,支持不同的服务用不同的语言来编写,比如a服务用python,b服务用java,C服务用php等,我们称为异构语言,那么在利用zuul来代理访问服务的时…

java整数常量区_在Java中,我可以用二进制格式定义一个整数常量吗?
所以,随着Java SE 7的发布,二进制表示法是标准的。 如果你对二进制有一个很好的理解,语法是非常简单明了的。byte fourTimesThree 0b1100; byte data 0b0000110011; short number 0b111111111111111; int overflow 0b1010101010101010101…

[LeetCode 120] - 三角形(Triangle)
问题 给出一个三角形,找出从顶部至底部的最小路径和。每一步你只能移动到下一行的邻接数字。 例如,给出如下三角形: [ [2], [3,4], [6,5,7], [4,1,8,3] ] 从顶部至底部的最小路径和为11(即235111)。 注意: …

中国电子学会scratch等级考试四级编程题:找出出现次数最多的数字
「青少年编程竞赛交流群」已成立(适合6至18周岁的青少年),公众号后台回复【Scratch】或【Python】,即可进入。如果加入了之前的社群不需要重复加入。 我们将有关编程题目的教学视频已经发布到抖音号21252972100,小马老…

人工智能 有信息搜索 (启发式)
一、最佳优先搜索 根据评价函数选择表现的最佳的节点进行扩展 最佳优先搜索 best-first-search 算法 不同的方法有不同的评价函数 启发函数,标记h(x) h(n)从节点n到目标的最低耗散估计值 启发函数是额外信息的一种最普通的形式 二、贪婪最佳优先搜索 最先扩展离目标…

java 排序算法 讲解_java实现排序算法之冒泡排序法详细讲解
冒泡排序(Bubble Sort),是一种计算机科学领域的较简单的排序算法。它重复地走访过要排序的数列,一次比较两个元素,如果他们的顺序错误就把他们交换过来。走访数列的工作是重复地进行直到没有再需要交换,也就是说该数列已经排序。这…