Eclipse中设置注释模板

一、进入注释模板设置界面

        Window->Preference->Java->Code Style->Code Template-->Comments

        如下图所示:

Eclipse中设置注释模板_第1张图片

        鼠标左键点击想要编辑的Comment,然后点击右边的Edit按钮进行设置,编辑结束后点击Apply And Close

Eclipse中设置注释模板_第2张图片

二、常用的注解解释

        @version:(版本,具体版本信息自己来定)

        @Description: (对类或方法等进行功能描述) 

        @author: zmp (作者)

        @return 返回值

        @throws 异常类及抛出条件

        @date: datedate{time} (日期) 

        ${tags}(展示方法参数和返回值) 

三、常用Comment的具体设置

1、Files

/**
* 

Title: ${file_name}

*

Description:

*

Copyright: Copyright (c) 2018

*

Company: www.baidudu.com

* @author sunhui * @date ${date} * @version 1.0 */

2、Types

/** 
* 

Title: ${type_name}

*

Description:

* @author sunhui * @date ${date} */

3、Fields

/** ${field}*/  

4、Constructors

/**  
* 

Title:

*

Description:

* ${tags} */

5、Methods

/**  
 * 

Title: ${enclosing_method}

*

Description:

* ${tags} */

四、注释模板的导入和导出

Eclipse中设置注释模板_第3张图片

 注意:注释模板编辑后一定要点击Apply进行保存

你可能感兴趣的:(IT,Tools)