myeclipse中java文件頭注釋格式設置


windows->preferences->java->Code Templates->comments->Type->edit 

Eclipse注釋規范模版總結

新建類文件
/**
 * @ClassName:     ${file_name}
 * @Description:   ${todo}(用一句話描述該文件做什么) 
 * 
 * @author         ${user}
 * @version        V1.0  
 * @Date           ${date} ${time} 
 */

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


輸入設置模板: 

/**      
* ${file_name} Create on ${date}     
*      
* Copyright (c) ${date} by taotaosoft      
*      
* @author <a href="xiuzhong.li@gmail.com">Jerryli</a>     
* @version 1.0 
*     
*/ 

注意選擇自動添加注釋 

養成一個規范的習慣是最好的。 


選菜單 
windows-->preference 
Java-->Code Style-->Code Templates 
code-->new Java files 

選中點編輯 

${filecomment} 
${package_declaration} 
/** 
* @author 作者姓名  E-mail: email地址 
* @version 創建時間:${date} ${time} 
* 類說明 
*/ 
${typecomment} 
${type_declaration} 

 

 

 Eclipse注釋規范模版總結

1、  具體操作

(1)在eclipse中,打開Window->Preference->Java->Code Style->Code Template

(2)然后展開Comments節點就是所有需設置注釋的元素,參照2注釋規范對應設置即可

2、  注釋規范

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

/**

 * FileName:     ${file_name}

 * @Description: ${todo}(用一句話描述該文件做什么)

* All rights Reserved, Designed By ZTE-ITS

 * Copyright:    Copyright(C) 2010-2011

 * Company       ZTE-ITS WuXi LTD.

 * @author:    名字

 * @version    V1.0 

 * Createdate:         ${date} ${time}

 *

 * Modification  History:

 * Date         Author        Version        Discription

 *

 * ${date}       wu.zh          1.0             1.0

 * Why & What is modified: <修改原因描述>

 */

 

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

 

/**

 * @ClassName:     ${type_name}

 * @Description:${todo}(這里用一句話描述這個類的作用)

 * @author:    Android_Robot

 * @date:        ${date} ${time}

 *

 * ${tags}

 */

 

(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> 

 */ 

 

ren


免責聲明!

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



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