设置注释模板的入口:Window->Preference->Java->Code Style->Code Template 然后展开Comments节点就是所有需设置注释的元素。本文现就每一个元素逐一给大家介绍一下。
文件(Files)注释标签:

1
2
3
4
5
6
7
8
/**
* @Title: ${file_name}
* @Package ${package_name}
* @Description: ${todo}(用一句话描述该文件做什么)
* @author ${user}
* @date ${date}
* @version V1.0
*/

类型(Types)注释标签(类的注释):

1
2
3
4
5
6
7
8
/**
* @ClassName: ${type_name}
* @Description: ${todo}(这里用一句话描述这个类的作用)
* @author ${user}
* @date ${date}
*
* ${tags}
*/

字段(Fields)注释标签:

1
2
3
/**
* @Fields ${field} : ${todo}(用一句话描述这个变量表示什么)
*/

构造函数(Constructor)标签:

1
2
3
4
5
/**
* 创建一个新的实例 ${enclosing_type}.
*
* ${tags}
*/

方法(Methods)标签:

1
2
3
4
5
6
7
/**
* @Title: ${enclosing_method}
* @Description: ${todo}(这里用一句话描述这个方法的作用)
* @param ${tags}    参数
* @return ${return_type}    返回类型
* @throws
*/

覆盖方法(Overriding Methods)标签:

1
2
3
4
5
6
/* (非 Javadoc)
* <p>Title: ${enclosing_method}</p>
* <p>Description: </p>
* ${tags}
* ${see_to_overridden}
*/

代理方法(Delegate Methods)标签:

1
2
3
4
/**
* ${tags}
* ${see_to_target}
*/

getter方法标签:

1
2
3
/**
* @return ${bare_field_name}
*/

setter方法标签:

1
2
3
/**
* @param ${param} the ${bare_field_name} to set
*/

要实现上面的注释模板,这需要将下面的配置文件导入就可以了:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<?xml version="1.0" encoding="UTF-8"?>
<templates>
    <template
                autoinsert="false"
                context="filecomment_context"
                deleted="false"
                description="Comment for created Java files"
                enabled="true"
                id="org.eclipse.jdt.ui.text.codetemplates.filecomment"
                name="filecomment">
    /**  
    * @Title: ${file_name}
    * @Package ${package_name}
    * @Description: ${todo}(用一句话描述该文件做什么)
    * @author ${user}
    * @date ${date}
    * @version V1.0  
    */
    </template>
    <template
                autoinsert="false"
                context="typecomment_context"
                deleted="false"
                description="Comment for created types"
                enabled="true"
                id="org.eclipse.jdt.ui.text.codetemplates.typecomment"
                name="typecomment">
    /**
    * @ClassName: ${type_name}
    * @Description: ${todo}(这里用一句话描述这个类的作用)
    * @author ${user}
    * @date ${date}
    *
    * ${tags}
    */
    </template>
    <template
                autoinsert="false"
                context="fieldcomment_context"
                deleted="false"
                description="Comment for fields"
                enabled="true"
                id="org.eclipse.jdt.ui.text.codetemplates.fieldcomment"
                name="fieldcomment">
    /**
    * @Fields ${field} : ${todo}(用一句话描述这个变量表示什么)
    */
    </template>
    <template
                autoinsert="false"
                  context="constructorcomment_context"
                deleted="false"
                description="Comment for created constructors"
                enabled="true"
                id="org.eclipse.jdt.ui.text.codetemplates.constructorcomment"
                name="constructorcomment">
    /**
     * 创建一个新的实例 ${enclosing_type}.
     *
     * ${tags}
     */
    </template>
        <template
                autoinsert="false"
                context="methodcomment_context"
                deleted="false"
                description="Comment for non-overriding methods"
                enabled="true"
                id="org.eclipse.jdt.ui.text.codetemplates.methodcomment"
                name="methodcomment">
    /**
    * @Title: ${enclosing_method}
    * @Description: ${todo}(这里用一句话描述这个方法的作用)
    * @param ${tags}    参数
    * @return ${return_type}    返回类型
    * @throws
    */
    </template>
    <template
                autoinsert="true"
                context="overridecomment_context"
                deleted="false"
                description="Comment for overriding methods"
                enabled="true"
                id="org.eclipse.jdt.ui.text.codetemplates.overridecomment"
                name="overridecomment">
    /* (非 Javadoc)
    * <p>Title: ${enclosing_method}</p>
    * <p>Description: </p>
    * ${tags}
    * ${see_to_overridden}
    */
    </template>
        <template
                autoinsert="true"
                context="delegatecomment_context"
                deleted="false"
                description="Comment for delegate methods"
                enabled="true"
                id="org.eclipse.jdt.ui.text.codetemplates.delegatecomment"
                name="delegatecomment">
    /**
     * ${tags}
     * ${see_to_target}
     */
    </template>
    <template
                autoinsert="false"
                context="gettercomment_context"
                deleted="false"
                description="Comment for getter method"
                enabled="true"
                id="org.eclipse.jdt.ui.text.codetemplates.gettercomment"
                name="gettercomment">
    /**
    * @return ${bare_field_name}
    */
    </template>
    <template
                autoinsert="true"
                context="settercomment_context"
                deleted="false"
                description="Comment for setter method"
                enabled="true"
                id="org.eclipse.jdt.ui.text.codetemplates.settercomment"
                name="settercomment">
    /**
     * @param ${param} the ${bare_field_name} to set
     */
    </template>
</templates>

Eclipse注释模板设置详解的更多相关文章

  1. 【转载】 Eclipse注释模板设置详解

     Eclipse注释模板设置详解 网站推荐: 金丝燕网(主要内容是 Java 相关) 木秀林网(主要内容是消息队列)

  2. [Java] Eclipse注释模板设置详解

    设置注释模板的入口: Window->Preference->Java->Code Style->Code Template 然后展开Comments节点就是所有需设置注释的元 ...

  3. 【转】Eclipse Java注释模板设置详解

    Eclipse Java注释模板设置详解   设置注释模板的入口: Window->Preference->Java->Code Style->Code Template 然后 ...

  4. Eclipse Java注释模板设置详解以及版权声明

    网上的Eclipse注释模板,在这里稍稍整理一些比较常用的. 编辑注释模板的方法:Window->Preference->Java->Code Style->Code Temp ...

  5. "佛祖保佑 永无bug" 注释模板设置详解(仅供娱乐)

    1.注释模板效果图 今天在网上看到一段有趣的注释,佛祖保佑 永无bug, 效果如下图所示:  代码如下所示: /** * _ooOoo_ * o8888888o * 88" . " ...

  6. Android Studio "佛祖保佑 永无bug" 注释模板设置详解(仅供娱乐)

    1.注释模板效果图 今天在网上看到一段有趣的注释,佛祖保佑 永无bug, 效果如下图所示: 代码如下所示: /** * _ooOoo_ * o8888888o * 88" . "8 ...

  7. Eclipse Java注释模板设置详解

    设置注释模板的入口: Window->Preference->Java->Code Style->Code Template 然后展开Comments节点就是所有需设置注释的元 ...

  8. Eclipse Java注释模板设置详解,更改 ${user}和${date}

    修改MyEclipse eclipse 注释的作者名字 转自:http://www.oschina.net/question/158170_31311 在eclipse/myeclipse中,当我们去 ...

  9. [转]Eclipse Java注释模板设置详解

    原文链接:http://blog.csdn.net/ahhsxy/archive/2009/09/11/4542682.aspx 设置注释模板的入口: Window->Preference-&g ...

随机推荐

  1. .NET Core采用的全新配置系统[6]: 深入了解三种针对文件(JSON、XML与INI)的配置源

    物理文件是我们最常用到的原始配置的载体,最佳的配置文件格式主要由三种,它们分别是JSON.XML和INI,对应的配置源类型分别是JsonConfigurationSource.XmlConfigura ...

  2. 初步认识Node 之Express

    通过本文,你会对Express有一个较为具体的了解.    起源 2009年6月26日,TJ Holowaychuk提交了Express的第一次commit,接下来在2010年1月2日,有660次co ...

  3. EasyUI中那些不容易被发现的坑——EasyUI重复请求2次的问题

    问题控件:datagrid.combobox.所有能设置url属性的控件 问题版本:1.4.4.1.4.5(之前的版本没测) 问题如图: 重复请求2次,错误代码如图: 错误问题分析:html加载的时候 ...

  4. Android面试一天一题(1Day)

    写在前面 该博客思路源于在简书看到goeasyway博主写的Android面试一天一题系列,无copy之意,仅为让自己总结知识点,成长一点点.先感谢各位大神的无私分享~! 关于题目,大部分则出自And ...

  5. Python(六)面向对象、异常处理、反射、单例模式

    本章内容: 创建类和对象 面向对象三大特性(封装.继承.多态) 类的成员(字段.方法.属性) 类成员的修饰符(公有.私有) 类的特殊成员 isinstance(obj, cls) & issu ...

  6. 利用WCF的双工通讯实现一个简单的心跳监控系统

    何为心跳监控系统? 故名思义,就是监控某个或某些个程序的运行状态,就好比医院里面的心跳监视仪一样,能够随时显示病人的心跳情况. 心跳监控的目的是什么? 与医院里面的心跳监视仪目的类似,监控程序运行状态 ...

  7. Ionic2系列——使用DeepLinker实现指定页面URL

    Ionic2使用了近似原生App的页面导航方式,并不支持Angular2的路由.这种方式在开发本地App的时候比较方便,但如果要用来开发纯Web页面就有点问题了,这种情况下Angular2的route ...

  8. CLR和.Net对象生存周期

    标签:GC .Net C# CLR 前言 1. 基础概念明晰 * 1.1 公告语言运行时 * 1.2 托管模块 * 1.3 对象和类型 * 1.4 垃圾回收器 2. 垃圾回收模型 * 2.1 为什么需 ...

  9. iOS-多线程介绍

    一.前言部分 最近在面试,重新温习了一遍多线程,希望加深一遍对于多线程的理解. 1.什么是进程? 1).要了解线程我们必须先了解进程,通俗来讲进程就是在系统中运行的一个应用程序. 2).每个线程之间是 ...

  10. 细谈Slick(5)- 学习体会和将来实际应用的一些想法

    通过一段时间的学习和了解以及前面几篇关于Slick的讨论后对Slick这个函数式数据库编程工具有了些具体的了解.回顾我学习Slick的目的,产生了许多想法,觉着应该从实际的工作应用角度把我对Slick ...