設(shè)置注釋模板的入口:Window->Preference->Java->Code Style->Code Template 然后展開Comments節(jié)點就是所有需設(shè)置注釋的元素。每個元素解釋如下:
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 構(gòu)造函數(shù)的注釋
/**
* 創(chuàng)建一個新的實例 ${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 導(dǎo)出xml,以后就可以通過 Import導(dǎo)入了。
如上的配置文件已經(jīng)傳至github
https://github.com/Yao544303/config