Eclipse 模板
Eclipse 的模板:推荐一个好的内容
设置注释模板的入口:Window->Preference->Java->Code Style->Code Template 然后展开Comments节点就是所有需设置注释的元素。本文现就每一个元素逐一给大家介绍一下。
文件(Files)注释标签:
/**
* @Title: ${file_name}
* @Package ${package_name}
* @Description: ${todo}(用一句话描述该文件做什么)
* @author ${user}
* @date ${date}
* @version V1.0
*/
类型(Types)注释标签(类的注释):
/**
* @ClassName: ${type_name}
* @Description: ${todo}(这里用一句话描述这个类的作用)
* @author ${user}
* @date ${date}
*
* ${tags}
*/
字段(Fields)注释标签:
/**
* @Fields field:field:{todo}(用一句话描述这个变量表示什么)
*/
构造函数(Constructor)标签:
/**
* 创建一个新的实例 ${enclosing_type}.
*
* ${tags}
*/
方法(Methods)标签:
/**
* @Title: ${enclosing_method}
* @Description: ${todo}(这里用一句话描述这个方法的作用)
* @param ${tags} 参数
* @return ${return_type} 返回类型
* @throws
*/
覆盖方法(Overriding Methods)标签:
/* (非 Javadoc)
* <p>Title: ${enclosing_method}</p>
* <p>Description: </p>
* ${tags}
* ${see_to_overridden}
*/
代理方法(Delegate Methods)标签:
/**
* ${tags}
* ${see_to_target}
*/
getter方法标签:
/**
* @return ${bare_field_name}
*/
setter方法标签:
/**
* @param paramtheparamthe{bare_field_name} to set
*/
要实现上面的注释模板,这需要将下面的配置文件导入就可以了:
<?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: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 paramtheparamthe{bare_field_name} to set
*/
</template>
</templates>
---------------------
作者:oO归去来兮Oo
来源:CSDN
原文:https://blog.csdn.net/paul342/article/details/52982585
版权声明:本文为博主原创文章,转载请附上博文链接!
Eclipse 模板的更多相关文章
- eclipse模板
文件(Files)注释标签: /** * @Title: ${file_name} * @Package ${package_name} * @Description: ${todo}(用一句话描述该 ...
- Java规范化代码eclipse模板注释
建议下载阿里规范化插件 阿里的new java file的注释模板(Type): /** * @author ${user} * @date ${currentDate:date('YYYY/MM ...
- Eclipse小技巧--快速输入System.out.println();(转)
步骤1:指定“Content Assist”的快捷键,参考:善用 Eclipse 组合键,提高输入效率 步骤2:输入源代码是,先输入sysout,然后输入辅助快捷键:Alt+/,这样就可以自动生成:S ...
- Android Studio 增加函数注释模板
此篇文章主要介绍如何在Android Studio中函数如何添加注释,使其和eclipse一样方便的添加注释 Android Studio默认函数注释为 /** * */ 下面方法将要改为如下格式 / ...
- Android Studio新建类头部注释和添加函数注释模板及快捷键
一,Android Studio新建类头部注释 是不是有时候看到这个很心烦 其实Studio中有设置修改这些注释模板的信息的功能 其实很简单,只需要两步: 1.打开Setting设置面板,找到File ...
- 使用 Google Guava 美化你的 Java 代码
文章转载自:http://my.oschina.net/leejun2005/blog/172328 目录:[ - ] 1-使用 GOOGLE COLLECTIONS,GUAVA,STATIC IMP ...
- Guava 教程1-使用 Google Collections,Guava,static imports 编写漂亮代码
原文出处: oschina (API:http://ifeve.com/category/framework/guava-2/ JAR DOC Source 链接:http://pan.baidu.c ...
- Android训练课程(Android Training) - 构建你的第一个应用
本文翻译自:https://developer.android.com/training/basics/firstapp/index.html 构建你的第一个应用(app) 欢迎来到安卓开发! 这个课 ...
- j2se回想
执行Java程序. Java程序有两种方式一种是jar包.一种是class. 执行jar,Java -jar XXX.jar执行的时候,Java.exe调用GetMainClassName函数,该函数 ...
随机推荐
- Dynamics CRM 配置 OAuth 2.0
关注本人微信和易信公众号: 微软动态CRM专家罗勇 ,回复124或者20140324可方便获取本文,同时可以在第一时间得到我发布的最新的博文信息,follow me! 本博文主要参考但不限于如下资料: ...
- 理解Device Tree Usage(续)
4 How Interrupts work 与遵循树的自然结构的地址范围转换不同, 中断信号可以起源于或者终止于板卡上的任何设备. 与设备树中自然表示的设备寻址不同,中断信号的表示独立于设备树节点 ...
- Windows Server 2016-PS筛选导出用户邮箱属性包含某字段列表
生产环境中我们往往会遇到以多个邮箱别名结尾的情况,如何快速导出当前域用户邮箱以某字段或后缀结尾的用户列表信息变得尤为重要,本例简单汇总下如何通过Powershell快速筛选出当前邮箱信息包含azure ...
- 多媒体管理器解析IMultimediaManager
一.基本API bool Available { get; } bool Working { get; } AdvancedOptions Advanced { get; } 二.作为通信引擎 str ...
- 腾迅云CDN的使用
一开始,我是想和七牛云一样,将腾迅云的对象存储作为网盘使用,不过在折腾的时间,搞不清楚腾迅云CDN的用法,最后看文档,看博客,大概了解了 这里讲两种用法,一种是结合对象存储,作一个静态网站或下载站,但 ...
- 为什么从前那些.NET开发者都不写单元测试呢?
楔子 四年前我虽然也写了很多年代码,由于公司虽然规模不小,却并非一家规范化的软件公司,因此在项目中严格意义上来说并没有架构设计.也不写单元测试,后来有幸加入了一家公司,这家公司虽然也是一家小公司,但是 ...
- stylus 详解与引入
Stylus介绍及特点Stylus 是一个基于Node.js的CSS的预处理框架,诞生于2010年,比较年轻,可以说是一种新型语言,其本质上做的事情与 Sass/LESS 等类似, 可以以近似脚本的方 ...
- [开发技巧]·AdaptivePooling与Max/AvgPooling相互转换
[开发技巧]·AdaptivePooling与Max/AvgPooling相互转换 个人网站--> http://www.yansongsong.cn/ 1.问题描述 自适应池化Adaptive ...
- 微信小程序开发07-列表页面怎么做
接上文:微信小程序开发06-一个业务页面的完成 github地址:https://github.com/yexiaochai/wxdemo 我们首页功能基本完成,我对比了下实际工作中的需求,完成度有7 ...
- 【带着canvas去流浪(5)】绘制K线图
目录 一. 任务说明 二. 重点提示 三. 示例代码 示例代码托管在:http://www.github.com/dashnowords/blogs 博客园地址:<大史住在大前端>原创博文 ...