设置注释模板的入口: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. Eclipse注释模板设置详解

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

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

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

  4. eclipse注释模板设置(未整理)

    Window --> Java --> Code Style --> Code Templates --> Comments --> types --> Edit  ...

  5. Eclipse注释模板设置

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

  6. eclipse 注释模板设置

    方法注释模板 /** * @title ${enclosing_method} * @description ${todo} * ${tags} ${return_type} * @Date ${da ...

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

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

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

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

  9. IDEA中设置注释模板的方法

    IDEA中设置注释模板主要分为两个部分,分别是创建java文件时类的注释和方法的注释. 这里为大家详细介绍一下方法,按MyEclipse的风格设置(MyEclipse的请看:MyEclipse中设置注 ...

随机推荐

  1. 用css3的cursor:zoom-in/zoom-out实现微博看图片放大镜效果

    1.前言 CSS3的出现解决了很多让人头疼的问题,至少我想很多童鞋都这样认为.css3的cursor属性大家用的应该是非常的多的,我想用的比较多的像cursor:pointer;cursor:help ...

  2. HDU 6069

    Counting Divisors Problem Description In mathematics, the function d(n) denotes the number of diviso ...

  3. wamp+python+CGI+wingIDE

    一.环境配置情况 windows7 32位 wamp​2.5 python3.5.2 wingIDE​5.1.12 上述软件下载安装按照自己的意愿行事. 二.​配置 wamp支持cgi和python: ...

  4. HDU 6033 Add More Zero (数学)

    Description There is a youngster known for amateur propositions concerning several mathematical hard ...

  5. Mysql事务处理详细讲解及完整实例下载

    一.Mysql事务概念 MySQL 事务主要用于处理操作量大,复杂度高的数据.由一步或几步数据库操作序列组成逻辑执行单元,这系列操作要么全部执行,要么全部放弃执行.在 MySQL 中只有使用了 Inn ...

  6. 从Google Play下载应用并不安全,上千款监视软件伪装其中

    如果你认为在官方应用市场里下载app就觉得安全的话,小编可以负责任的回答你:"too young too simple,sometimes native" 今年4月,BankBot ...

  7. 安卓APP测试容易忽略的地方

    我们手机APP测试,主要针对的是android和ios两大主流操作系统,总体上来说android手机型号.版本多,bug也多:ios相对bug少.下面就针对Android说一下最容易忽略的测试点吧. ...

  8. Python下的OpenCV学习 02 —— 图像的读取与保存

    OpenCV提供了众多对图片操作的函数,其中最基本的就是图片的读取与输出了. 一.读取图片 利用OpenCV读取一张图片是非常容易的,只需要用到 imread() 函数,打开shell或者cmd,进入 ...

  9. SpringMVC入门--编写一个SpringMVC小程序

    一.SpringMVC的优势 Spring 为展现层提供的基于 MVC 设计理念的优秀的Web 框架,是目前最主流的 MVC 框架之一.Spring3.0 后全面超越 Struts2,成为最优秀的 M ...

  10. Struts2之初识

    Struts2教程 第一章 初识Struts2 主页:http://struts.apache.org/ 优势:用户请求,模块处理,页面展现.适用于企业级开发,便于维护. 配置:web.xml中添加的 ...