Eclipse的Code Templates配置
可以根据自己需求适当添加删减一些内容
打开Window->Preferences->Java->Code Style->Code Templates
编辑以下对应项目
Comments–>Files(Java文件注释)
/**
* Project Name:${project_name}
* File Name:${file_name}
* Package Name:${package_name}
* Date:${date}${time}
* Copyright (c) ${year}, JUTIL.NET All Rights Reserved.
*
*/
Comments–>Types(Java类注释)
/**
* ClassName: ${type_name} <br/>
* Function: ${todo} ADD FUNCTION. <br/>
* Reason: ${todo} ADD REASON(可选). <br/>
* date: ${date} ${time} <br/>
*
* @author ${user}
* @version ${enclosing_type}${tags}
* @since JDK 1.8
*/
Comments–>Fields(类字段注释)
/**
* ${field}:${todo}(用一句话描述这个变量表示什么).
* @since JDK 1.8
*/
Comments–>Constructors(构造函数注释)
/**
* Creates a new instance of ${enclosing_type}.
*
* ${tags}
*/
Comments–>Methods(Java方法注释)
/**
* ${enclosing_method}:(这里用一句话描述这个方法的作用). <br/>
* ${todo}(这里描述这个方法适用条件 – 可选).<br/>
* ${todo}(这里描述这个方法的执行流程 – 可选).<br/>
* ${todo}(这里描述这个方法的使用方法 – 可选).<br/>
* ${todo}(这里描述这个方法的注意事项 – 可选).<br/>
*
* @author ${user}
* ${tags}
* @since JDK 1.8
*/
Comments–>Overriding methods(重写方法注释)
/**
* ${todo} 简单描述该方法的实现功能(可选).
* ${see_to_overridden}
*/
Comments–>Delegate methods(代理方法注释)
/**
* ${tags}
* ${see_to_target}
*/
Comments–>Getters(Java Getter方法注释)
/**
* ${bare_field_name}.
*
* @return the ${bare_field_name}
* @since JDK 1.8
*/
Comments–>Setters(Java Setters方法注释)
/**
* ${param}.
*
* @param ${param} the ${bare_field_name} to set
* @since JDK 1.8
*/
Code–>New Java files(新建java文件代码模板)
${filecomment}
${package_declaration}
/**
* ClassName:${type_name} <br/>
* Function: ${todo} ADD FUNCTION. <br/>
* Reason: ${todo} ADD REASON. <br/>
* Date: ${date} ${time} <br/>
* @author ${user}
* @version
* @since JDK 1.8
* @see
*/
${typecomment}
${type_declaration}
Code–>Method body(方法体模板)
// ${todo} Auto-generated method stub
${body_statement}
Code–>Constructor body(构造函数模板)
${body_statement}
// ${todo} Auto-generated constructor stub
Code–>Getter body(字段Getter方法模板)
return ${field};
Code–>Setter body(字段Setter方法模板)
${field} = ${param};
Code–>Catch block body(异常catch代码块模板)
// ${todo} Auto-generated catch block
${exception_var}.printStackTrace();