Enrich the content of Eclipse annotations

Source: Internet
Author: User

How to enrich the content of Eclipse annotations

Comments, Code Templates---Preferences, Windows, Eclipse, Window (Comments represents a comment template)

1. Files (Java file comments)

/***/

2. Types (Java class comment)

/**@author @version @since*/

3. Fields (class field comment)

/**@since* /

4. Constructors (constructor comment)

/***/

5. Methods (Java method Comment)

/**@author@since* /

6. Overriding methods (override method Comment)

/***/

7, Delegate methods (Agent method Comment)

/***/

8. Getters (Java getter method Comment)

/**@return@since  * /   

9. Setters (Java Setters method Comment)

/**@param   ${param}    @since*   /

Code Templates, Code Preferences, Windows, Eclipse, Window

1. New Java files (new Java file Code template)

/*** Project name:${project_name} * File name:${file_name} * Package Name:${package_name} * date:${date}${time} * Copyr Ight (c) ${year}, [email protected] All rights Reserved. **/${filecomment}${package_declaration}/*** Classname:${type_name} <br/> * Function: ${todo} add Function. <br/> * Reason: ${todo} add Reason. <br/> * Date: ${date} ${time} <br/> *@author${user} *@version   * @sinceJDK 1.6 *@see       */${typecomment}${type_declaration}

2. Method body (Methods body template)

// ${todo} auto-generated method stub${body_statement}

3. Constructor body (constructor template)

${body_statement} // ${todo} auto-generated constructor stub

4. Getter Body (Field Getter method template

return ${field};

5. Setter Body (field setter method template)

${field} = ${param};

6. Catch block body (Exception catch code block template)

// ${todo} auto-generated catch block${exception_var}.printstacktrace ();

The detailed codetemplates.xml are as follows:

<?xml version= "1.0" encoding= "UTF-8" standalone= "no"? ><templates><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 ">/*** ${bare_field_name}. * *@returnThe ${bare_field_name} *@sinceJDK 1.6*/</template><template autoinsert= "false" context= "Settercomment_context" deleted= "false" description= " Comment for Setter method "enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.settercomment "Name=" Settercomment ">/*** ${param}. * *@param${param} The ${bare_field_name} to set *@sinceJDK 1.6*/</template><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" >/*** Creates a new instance of ${enclosing_type}. * * ${tags}*/</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 ">/*** Project name:${project_name} * File name:${file_name} * Package Name:${package_name} * date:${date}${time} * Copyri Ght (c) ${year}, [email protected] All rights Reserved. * */</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 " >/*** ClassName: ${type_name} &lt;br/&gt; * function: ${todo} ADD Function. &lt;br/&gt; * Reason: ${todo} ADD REASON (optional). &lt;br/&gt; * Date: ${date} ${time} &lt;br/&gt; * * @author${user} *@version${enclosing_type}${tags} *@sinceJDK 1.6*/</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 ">/*** ${field}:${todo} (describe what this variable represents in a sentence). *@sinceJDK 1.6*/</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 ">/*** ${enclosing_method}:(here to describe the effect of this method). &lt;br/&gt; * ${todo} (This method is described here to apply conditions – optional) .&lt;br/&gt; * ${ TODO} (described here for the execution process of this method – optional) .&lt;br/&gt; * ${todo} (here is a description of how this method is used – optional) .&lt;br/&gt; * ${todo} (This method is described here for considerations – optional) .&lt;br/&gt; * * @author${user} * ${tags} *@sinceJDK 1.6*/</template><template autoinsert= "false" context= "Overridecomment_context" deleted= "false" description= " Comment for overriding methods "enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.overridecomment "Name=" Overridecomment ">/*** ${todo} simply describes the implementation of the method (optional). * ${see_to_overridden}*/</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 ">/*** ${tags} * ${see_to_target}*/</template><template autoinsert= "false" context= "Newtype_context" deleted= "false" description= "Newly Created files "enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.newtype "name=" Newtype ">/*** Project name:${project_name} * File name:${file_name} * Package Name:${package_name} * date:${date}${time} * Copyri Ght (c) ${year}, [email protected] All rights Reserved. **/${filecomment}${package_declaration}/*** Classname:${type_name} &lt;br/&gt; * function: ${todo} ADD Function. &lt;br/&gt; * Reason: ${to DO} ADD REASON. &lt;br/&gt; * Date: ${date} ${time} &lt;br/&gt; * @author${user} *@version   * @sinceJDK 1.6 *@see       */${typecomment}${type_declaration}</template><template autoinsert= "true" context= "Classbody_context" deleted= "false" description= "Code in New Class type Bodies "Enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.classbody "name=" Classbody "></ Template><template autoinsert= "true" context= "Interfacebody_context" deleted= "false" description= "Code in New Interface type Bodies "Enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.interfacebody "name=" Interfacebody " ></template><template autoinsert= "true" context= "Enumbody_context" deleted= "false" description= "Code in New enum type Bodies "Enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.enumbody "name=" Enumbody "></ Template><template autoinsert= "true" context= "Annotationbody_context" deleted= "false" description= "Code in New Annotation type bodies "enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.annotationbody "Name=" Annotationbody "></template><template autoinsert=" true "context=" Catchblock_contExt "deleted=" false "description=" Code in new catch blocks "enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.catchblock "name=" Catchblock ">//${todo} auto-generated catch block${exception_var}.printstacktrace ();</template><template autoinsert= "false" context= "Methodbody_context" deleted= "false" description= "Code in Created method stubs "enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.methodbody "name=" MethodBody ">//${todo} auto-generated method Stub${body_statement}</template><template autoinsert= "true" context= "Constructorbody_context" deleted= "false "Description=" Code in created constructor stubs "enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.constructorbody "name=" Constructorbody ">${body_statement}//${todo} auto-generated constructor stub</template><template autoinsert= "true" context= "Getterbody_context" deleted= "false" description= "Code in Created getters "enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.getterbody "name=" Getterbody ">return${field};</template><template autoinsert= "true" context= "Setterbody_context" deleted= "false" description= "Code in created Setters" enabled= "true" id= "Org.eclipse.jdt.ui.text.codetemplates.setterbody" name= "Setterbody" > ${field} = ${param};</template></templates>

Enrich the content of Eclipse annotations

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.