When generating Java annotations using MyEclipse, the code Template used

Source: Internet
Author: User

To set the entry for the comment template: Window->preference->java->code style->code templates,

then expand the Comments node is all the elements that need to be annotated.

The following are some examples:


Files Note Tags:

/**@author @version * * Package Com.candy.candy.test;

Type (Types) Comment Label (note for Class):

/**@author @version */public class Codestyletemplate {}

Methods (Constructor & Methods) Tags:

    /**      * TODO     @author  Candy czx     * @date 2014-10-24 morning 12:07:06     @version V1.0      @param arg1      @param arg2      @return     */     Public string Testcodestyletemplate (String arg1, String arg2) {        returnnull;    } 

Templates for the code style of other methods, properties, and so on, are configured by default values.

Attached: The above configuration of the Codetemplates.xml, directly to copy and paste.

<?XML version= "1.0" encoding= "UTF-8" standalone= "no"?><Templates><TemplateAutoInsert= "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) * ${see_to_overridden} */</Template><TemplateAutoInsert= "true"Context= "Fieldcomment_context"deleted= "false"Description= "Comment for Fields"enabled= "true"ID= "Org.eclipse.jdt.ui.text.codetemplates.fieldcomment"name= "Fieldcomment">/** *  */</Template><TemplateAutoInsert= "true"Context= "Constructorcomment_context"deleted= "false"Description= "Comment for created constructors"enabled= "true"ID= "Org.eclipse.jdt.ui.text.codetemplates.constructorcomment"name= "Constructorcomment">/** * ${tags} */</Template><TemplateAutoInsert= "true"Context= "Settercomment_context"deleted= "false"Description= "Comment for setter Method"enabled= "true"ID= "Org.eclipse.jdt.ui.text.codetemplates.settercomment"name= "Settercomment">/** * @param ${param} The ${bare_field_name} to set */</Template><TemplateAutoInsert= "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><TemplateAutoInsert= "false"Context= "Methodcomment_context"deleted= "false"Description= "Comment for non-overriding methods"enabled= "true"ID= "Org.eclipse.jdt.ui.text.codetemplates.methodcomment"name= "Methodcomment">/** * ${todo} * @author Candy CZX * @date ${date} ${time} * @version V1.0 * ${tags} */</Template><TemplateAutoInsert= "false"Context= "Typecomment_context"deleted= "false"Description= "Comment for created types"enabled= "true"ID= "Org.eclipse.jdt.ui.text.codetemplates.typecomment"name= "Typecomment">/** * ${tags} * ${todo} * @author Candy CZX * @date ${date} ${time} * @version V1.0 * *</Template><TemplateAutoInsert= "false"Context= "Filecomment_context"deleted= "false"Description= "Comment for created Java files"enabled= "true"ID= "Org.eclipse.jdt.ui.text.codetemplates.filecomment"name= "Filecomment">/** * @projectName ${project_name} * @package ${package_name}.${file_name} * @Copyright Copyright (c) ${year} Candy Union * @author Candy CZX * @date ${date} ${time} * @version V1.0 * *</Template><TemplateAutoInsert= "true"Context= "Gettercomment_context"deleted= "false"Description= "Comment for getter Method"enabled= "true"ID= "Org.eclipse.jdt.ui.text.codetemplates.gettercomment"name= "Gettercomment">/** * @return the ${bare_field_name} */</Template></Templates>

When generating Java annotations using MyEclipse, the code Template used

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.