Eclipse 注释模板

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

Files 文件的注释

/**
 * @Title: ${file_name}  
 * @Package: ${package_name}  
 * @Date: ${date}
 * @Author: ${user}
 * @Description: ${todo}
 */

Types 类的注释

/**
* @ClassName: ${type_name}  
 * @Author: ${user}
 * @Date: ${date}
 * ${tags}
 */

Fields 字段的注释

/**
 * @Fields field:field:{todo}
 */

Constructor 构造函数的注释

/**  
* 创建一个新的实例 ${enclosing_type}.  
*  
* ${tags}  
*/ 

Method 方法的注释

/**  
* @Title: ${enclosing_method}  
* @Description: ${todo}
* @Params: ${tags}      
* @Return: ${return_type}      
* @Throws    
*/  

Overriding Methods 覆盖方法的注释

/* (non-Javadoc)
 * @Title: ${enclosing_method}
 * @Description: ${todo}
 * ${tags}  
 * ${see_to_overridden} 
 */

Delegate Methods 代理方法的注释

/**
 * ${tags}
 * ${see_to_target}
 */

Getters 注释

/**
 * @return the ${bare_field_name}
 */

Setters 注释

/**
 * @param ${param} the ${bare_field_name} to set
 */

配置好之后,可以通过Window->Preference->Java->Code Style->Code Template >Export ALL 导出xml,以后就可以通过 Import导入了。

如上的配置文件已经传至github
https://github.com/Yao544303/config

Reference

1.http://blog.csdn.net/paul342/article/details/52982585

你可能感兴趣的:(Eclipse 注释模板)