eclipse - 自定義注釋模板(Code Template)


編輯注釋模板的方法:Window->Preference->Java->Code Style->Code Template 然后展開Comments節點就是所有需設置注釋的元素啦。現就每一個元素逐一介紹:

1.文件(Files)注釋標簽:

/**  
 * All rights Reserved, Designed By www.witsforce.com
 * @Title:  ${file_name}   
 * @Package ${package_name}   
 * @Description:    ${todo}(用一句話描述該文件做什么)   
 * @author: zhoux     
 * @date:   ${date} ${time}   //${d:date('yyyy/MM/dd HH:mm:ss')}
 * @version V1.0 
 * @Copyright: ${year} www.witsforce.com Inc. All rights reserved. 
 * 
 */  

2.類型(Types)注釋標簽(類的注釋):

/**   
 * @ClassName:  ${type_name}   
 * @Description:${todo}(這里用一句話描述這個類的作用)   
 * @author: zhoux 
 * @date:   ${date} ${time}   
 *   
 * ${tags}  
 * @Copyright: ${year} www.witsforce.com Inc. All rights reserved. 
 * 
 */ 

3.字段(Fields)注釋標簽:

/**   
 * @Fields ${field} : ${todo}(用一句話描述這個變量表示什么)  
 * 
 */ 

4.構造函數標簽:

/**   
 * @Title:  ${enclosing_type}   
 * @Description:    ${todo}(這里用一句話描述這個方法的作用)   
 * @param:  ${tags}  
 * @throws   
 *
 */  

5.方法(Methods)標簽:

/**   
 * @Title: ${enclosing_method}   
 * @Description: ${todo}(這里用一句話描述這個方法的作用)   
 * @param: ${tags}      
 * @return: ${return_type}      
 * @throws   
 *
 */ 

6.覆蓋方法(Overriding Methods)標簽:

/**   
 * <p>Title: ${enclosing_method}</p>   
 * <p>Description: </p>   
 * ${tags}   
 * ${see_to_overridden}   
 *
 */  

7.代表方法(Delegate Methods)標簽:

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

8.getter方法標簽:

/**  
 * @Title:  ${enclosing_method} <BR>  
 * @Description: please write your description <BR>  
 * @return: ${field_type} <BR>  
 *
 */ 

9.setter方法標簽:

/**  
 * @Title:  ${enclosing_method} <BR>  
 * @Description: please write your description <BR>  
 * @return: ${field_type} <BR>
 *   
 */  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM