关于Eclipse IDE中Java注解模板:
使用Eclipse IDE 进行应用程序开发时,以团队协作的方式进行开发,代码注释非常重要的,而且对代码注释的格式也要与团队保持一致性,为了保证代码的规范而且提高开发效率,
本博文以Java应用程序开发为例,介绍怎么在Eclipse IDE 自定义代码注解模板。
1、打开Eclipse工具,点击工具栏 Window -> Prefrences 进入参数选择Dialog,如下图:
2、在参数选择Dialog中依次选择 Java -> Code Style -> Code Template 进行代码的注解模板设置,如下图:
一下为我固定使用的注解模板:
Files :
- /**
- * <p> Title : ${file_name} </p>
- * <p> Description : ${todo} </p>
- * <p> Package : ${package_name} </p>
- * CreateDate : ${date} ${time} </p>
- * Author : HuaZai
- * @ContactInformation : xst@cdsy.xyz/009@cdsy.xyz
- *
- * @Version V1.0.0 </p>
- */
Types :
- /**
- * <p> ClassName : ${type_name} </p>
- * <p> Description : ${todo} </p>
- * CreateDate : ${date} ${time}
- * Author : HuaZai
- * @ContactInformation : xst@cdsy.xyz/009@cdsy.xyz
- * @Version : V1.0.0
- *
- * @param ${tags}
- */
Fields :
- /**
- * @Files ${field} : ${todo}
- */
Constructors :
- /**
- * <p> Title : ${enclosing_type} </p>
- * <p> Description : ${todo} </p>
- * @Throws
- *
- * @param ${tags}
- */
Methods :
- /**
- * <p> Title : ${enclosing_method} </p>
- * <p> Description : ${todo} </p>
- * CreateDate : ${date} ${time}
- * Author : HuaZai
- * @param ${tags}
- * @return ${return_type}
- * @throws
- */
Overriding Methods :
- /* (non-Javadoc)
- * <p> Title : ${enclosing_method} </p>
- * <p> Description : ${todo} </p>
- * @Param : ${tags}
- * ${see_to_overridden}
- */
Delegate Methods :
- /**
- * @param ${tags}
- * ${see_to_target}
- */
Getters :
- /**
- * @return the ${bare_field_name}
- */
Setters :
- /**
- * @param ${param} the ${bare_field_name} to set
- */
以上是我自己写的注解模板,写这篇博客的目的就是为了方便,每次新建项目的时候,或者更换工作环境的时候可以直接复制,就不用有去写了。
只是为了快速高效,仅此而已。