Android注释模板大全 (eclipse 和android studio均可使用)

来源:互联网 发布:js舞蹈培训中心好不好 编辑:程序博客网 时间:2024/05/22 18:24

文件(Files)注释标签:

[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. /**  
  2. * @Title: ${file_name}  
  3. * @Package ${package_name}  
  4. * @Description: ${todo}(用一句话描述该文件做什么)  
  5. * @author ${user}  
  6. * @date ${date}  
  7. * @version V1.0  
  8. */  

类型(Types)注释标签(类的注释):

[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. /**  
  2. * @ClassName: ${type_name}  
  3. * @Description: ${todo}(这里用一句话描述这个类的作用)  
  4. * @author ${user}  
  5. * @date ${date}  
  6. *  
  7. * ${tags}  
  8. */  

字段(Fields)注释标签:

[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. /**  
  2. * @Fields field:field:{todo}(用一句话描述这个变量表示什么)  
  3. */  
构造函数(Constructor)标签:

[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. /**  
  2. * 创建一个新的实例 ${enclosing_type}.  
  3. *  
  4. * ${tags}  
  5. */  

方法(Methods)标签:

[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. /**  
  2. * @Title: ${enclosing_method}  
  3. * @Description: ${todo}(这里用一句话描述这个方法的作用)  
  4. * @param ${tags}    参数  
  5. * @return ${return_type}    返回类型  
  6. * @throws  
  7. */  

覆盖方法(Overriding Methods)标签:

[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. /* (非 Javadoc)  
  2. <p>Title: ${enclosing_method}</p>  
  3. <p>Description: </p>  
  4. * ${tags}  
  5. * ${see_to_overridden}  
  6. */  

代理方法(Delegate Methods)标签:

[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. /**  
  2. * ${tags}  
  3. * ${see_to_target}  
  4. */  

getter方法标签:

[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. /**  
  2. * @return ${bare_field_name}  
  3. */  

setter方法标签:

[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. /**  
  2. * @param paramtheparamthe{bare_field_name} to set  
  3. */  

要实现上面的注释模板,这需要将下面的配置文件导入就可以了:

[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. <?xml version="1.0" encoding="UTF-8"?>  
  2. <templates>  
  3.     <template  
  4.                 autoinsert="false"  
  5.                 context="filecomment_context"  
  6.                 deleted="false"  
  7.                 description="Comment for created Java files"  
  8.                 enabled="true"  
  9.                 id="org.eclipse.jdt.ui.text.codetemplates.filecomment"  
  10.                 name="filecomment">  
  11.     /**    
  12.     * @Title: ${file_name}  
  13.     * @Package ${package_name}  
  14.     * @Description: ${todo}(用一句话描述该文件做什么)  
  15.     * @author ${user}  
  16.     * @date ${date}  
  17.     * @version V1.0    
  18.     */  
  19.     </template>  
  20.     <template  
  21.                 autoinsert="false"  
  22.                 context="typecomment_context"  
  23.                 deleted="false"  
  24.                 description="Comment for created types"  
  25.                 enabled="true"  
  26.                 id="org.eclipse.jdt.ui.text.codetemplates.typecomment"  
  27.                 name="typecomment">  
  28.     /**  
  29.     * @ClassName: ${type_name}  
  30.     * @Description: ${todo}(这里用一句话描述这个类的作用)  
  31.     * @author ${user}  
  32.     * @date ${date}  
  33.     *  
  34.     * ${tags}  
  35.     */  
  36.     </template>  
  37.     <template  
  38.                 autoinsert="false"  
  39.                 context="fieldcomment_context"  
  40.                 deleted="false"  
  41.                 description="Comment for fields"  
  42.                 enabled="true"  
  43.                 id="org.eclipse.jdt.ui.text.codetemplates.fieldcomment"  
  44.                 name="fieldcomment">  
  45.     /**  
  46.     * @Fields field:field:{todo}(用一句话描述这个变量表示什么)  
  47.     */  
  48.     </template>  
  49.     <template  
  50.                 autoinsert="false"  
  51.                   context="constructorcomment_context"  
  52.                 deleted="false"  
  53.                 description="Comment for created constructors"  
  54.                 enabled="true"  
  55.                 id="org.eclipse.jdt.ui.text.codetemplates.constructorcomment"  
  56.                 name="constructorcomment">  
  57.     /**  
  58.      * 创建一个新的实例 ${enclosing_type}.  
  59.      *  
  60.      * ${tags}  
  61.      */  
  62.     </template>  
  63.         <template  
  64.                 autoinsert="false"  
  65.                 context="methodcomment_context"  
  66.                 deleted="false"  
  67.                 description="Comment for non-overriding methods"  
  68.                 enabled="true"  
  69.                 id="org.eclipse.jdt.ui.text.codetemplates.methodcomment"  
  70.                 name="methodcomment">  
  71.     /**  
  72.     * @Title: ${enclosing_method}  
  73.     * @Description: ${todo}(这里用一句话描述这个方法的作用)  
  74.     * @param ${tags}    参数  
  75.     * @return ${return_type}    返回类型  
  76.     * @throws  
  77.     */  
  78.     </template>  
  79.     <template  
  80.                 autoinsert="true"  
  81.                 context="overridecomment_context"  
  82.                 deleted="false"  
  83.                 description="Comment for overriding methods"  
  84.                 enabled="true"  
  85.                 id="org.eclipse.jdt.ui.text.codetemplates.overridecomment"  
  86.                 name="overridecomment">  
  87.     /* (非 Javadoc)  
  88.     * <p>Title: ${enclosing_method}</p>  
  89.     * <p>Description: </p>  
  90.     * ${tags}  
  91.     * ${see_to_overridden}  
  92.     */  
  93.     </template>  
  94.         <template  
  95.                 autoinsert="true"  
  96.                 context="delegatecomment_context"  
  97.                 deleted="false"  
  98.                 description="Comment for delegate methods"  
  99.                 enabled="true"  
  100.                 id="org.eclipse.jdt.ui.text.codetemplates.delegatecomment"  
  101.                 name="delegatecomment">  
  102.     /**  
  103.      * ${tags}  
  104.      * ${see_to_target}  
  105.      */  
  106.     </template>  
  107.     <template  
  108.                 autoinsert="false"  
  109.                 context="gettercomment_context"  
  110.                 deleted="false"  
  111.                 description="Comment for getter method"  
  112.                 enabled="true"  
  113.                 id="org.eclipse.jdt.ui.text.codetemplates.gettercomment"  
  114.                 name="gettercomment">  
  115.     /**  
  116.     * @return ${bare_field_name}  
  117.     */  
  118.     </template>  
  119.     <template  
  120.                 autoinsert="true"  
  121.                 context="settercomment_context"  
  122.                 deleted="false"  
  123.                 description="Comment for setter method"  
  124.                 enabled="true"  
  125.                 id="org.eclipse.jdt.ui.text.codetemplates.settercomment"  
  126.                 name="settercomment">  
  127.     /**  
  128.      * @param paramtheparamthe{bare_field_name} to set  
  129.      */  
  130.     </template>  
  131. </templates>  
0 0
原创粉丝点击