Install the eclipse/myeclipse annotation line Template
Annotation is more important than code ??
Of course! In the entire life cycle of a project, the maintenance cost is often several times the development cost.
Therefore, the maintainability and reusability of a project are the key to measuring the quality of a project. Comments are an essential part of maintainability.
Installation Method:
Open Eclipse/myeclipse
Choose window --> preferences --> JAVA --> code templates, click Import on the right, and select the template. xml file you have written.
Import it.
Usage:
When creating a new class, check the "generate comments" option. The annotations defined in your annotation template are automatically added to the newly created class.
The following is a comment row template codetemplates. XML, which can be directly imported and used. Post the source code for your reference
<? XML version = "1.0" encoding = "UTF-8"?> <Templates> <template autoinsert = "false" context = "constructorcomment_context" deleted = "false" Description = "comment for created constructors" enabled = "true" id = "org. eclipse. jdt. UI. text. codetemplates. constructorcomment "name =" constructorcomment "> <br/>/** <br/> * Create a new instance $ {enclosing_type }. <br/> * $ {tags} <br/> */</template> <template autoinsert = "true" context = "settercomment_context" deleted = "false "Description =" comment for setter method "enabled =" true "id =" org. eclipse. jdt. UI. text. codetemplates. settercomment "name =" settercomment ">/** <br/> * @ Param $ {Param} the $ {bare_field_name} to set <br/> */</template> <template autoinsert = "false" context = "methodcomment_context" deleted = "false" Description = "comment for non-overriding methods" enabled = "true" id = "org. eclipse. jdt. UI. text. codetemplates. methodcomment "name =" methodcomment ">/** </P> <p> * $ {enclosing_method} (Here we describe the role of this method in one sentence) </P> <p> * todo (the applicable conditions of this method are described here-optional) </P> <p> * todo (the execution process of this method is described here-optional) </P> <p> * todo (here describes the use of this method-optional) </P> <p> * todo (here describes the precautions for this method-optional) </P> <p> * @ Param name </P> <p> * @ Param @ return setting file </P> <p> * @ return string DOM object </P>/ p> <p> * @ exception object </P> <p> * @ since codingexample Ver (view the encoding example) 1.1 </P> <p> */</template> <template autoinsert = "true" context = "delegatecomment_context" deleted = "false" Description = "comment for delegate methods" Enabled = "true" id = "org. eclipse. jdt. UI. text. codetemplates. delegatecomment "name =" delegatecomment ">/** <br/> * $ {tags} <br/> * $ {see_to_target} <br/> */</template> <template autoinsert = "false" context = "filecomment_context" deleted = "false" Description = "comment for created java files" enabled = "true" id = "org. eclipse. jdt. UI. text. codetemplates. filecomment "name =" filecomment ">/** <br/> * file name: $ {file_name} <br/> * version information: <br/> * Date: $ {date} <br/> * copyright Corporation $ {year} <br/> * copyright <br/> */</template> <Template autoinsert = "false" context = "gettercomment_context" deleted = "false" Description = "comment for getter method" enabled = "true" id = "org. eclipse. jdt. UI. text. codetemplates. gettercomment "name =" gettercomment ">/** <br/> * $ {bare_field_name} <br/> * @ return the $ {bare_field_name} <br/> * @ since codingexample Ver (view the encoding example) 1.0 <br/> */<br/> </template> <template autoinsert = "true" context = "overridecomment_context" deleted = "false" Description = "comment for overriding methods" enabled = "true" id = "org. eclipse. jdt. UI. text. codetemplates. overridecomment "name =" overridecomment ">/* (non-javadoc) <br/> * $ {see_to_overridden} <br/> */</template> <template autoinsert = "false" context = "fieldcomment_context" deleted = "false" Description = "comment for fields "enabled =" true "id =" org. eclipse. jdt. UI. text. codetemplates. fieldcomment "name =" fieldcomment ">/** <br/> * $ {field }:$ {todo} (describe what this variable represents in one sentence) <br/> * @ since ver 1.1 <br/> */<br/> </template> <template autoinsert = "false" context = "typecomment_context" deleted = "false" Description = "comment for created types" enabled = "true" id = "org. eclipse. jdt. UI. text. codetemplates. typecomment "name =" typecomment ">/** <br/> * Project name: $ {project_name} <br/> * Class Name: $ {type_name} <br/> * class description: <br/> * Creator: $ {user} <br/> * Creation Time: $ {date }$ {time} <br/> * modifier: $ {user} <br/> * modification time: $ {date }$ {time} <br/> * modify remarks: <br/> * @ version <br/> */</template> </templates>