Eclipse Comment template settings in detail

Source: Internet
Author: User

Set the entry for the comment template: Window->preference->java->code style->code template and then expand the Comments node is all the elements that need to be annotated. This article is now on each element to introduce you to each one.

Files Note Tags:

/*** @Title: ${file_name}* @Package ${package_name}* @Description: ${todo} (describe the file in a word) * @author ${user}* @date ${date} * @version v1.0*/

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

/*** @ClassName: ${type_name}* @Description: ${todo} (here is a word describing the role of this class) * @author ${user}* @date ${date}** ${tags}*/

Field Comment Label:

/*** @Fields ${field}: ${todo} (describe what this variable means in a word) */

Constructor (Constructor) Tags:

/*** Create a new instance ${enclosing_type}.** ${tags}*/

Method (Methods) Label:

/*** @Title: ${enclosing_method}* @Description: ${todo} (here is a word describing the function of this method) * @param ${tags}    parameter * @return ${return_type }    return type * @throws */

Override method (overriding Methods) Label:

< P > Title: ${enclosing_method}</p><p> </ P > * ${tags}* ${see_to_overridden}*/

Proxy method (Delegate Methods) Tags:

/*** ${tags}* ${see_to_target}*/

Getter Method Tags:

/*** @return ${bare_field_name}*/

Setter Method Tags:

/*** @param ${param} The ${bare_field_name} to set*/

To implement the above comment template, this requires the following configuration file to be imported:

<?XML version= "1.0" encoding= "UTF-8"?><Templates>    <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">/** * @Title: ${file_name} * @Package ${package_name} * @Description: ${todo} (describe the file in a word) * @autho R ${user} * @date ${date} * @version V1.0 * *</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">/** * @ClassName: ${type_name} * @Description: ${todo} (here is a word describing the role of this class) * @author ${user} * @date ${dat e} * * ${tags} */</Template>    <TemplateAutoInsert= "false"Context= "Fieldcomment_context"deleted= "false"Description= "Comment for Fields"enabled= "true"ID= "Org.eclipse.jdt.ui.text.codetemplates.fieldcomment"name= "Fieldcomment">/** * @Fields ${field}: ${todo} (describe what this variable means in a word) */</Template>    <TemplateAutoInsert= "false"Context= "Constructorcomment_context"deleted= "false"Description= "Comment for created constructors"enabled= "true"ID= "Org.eclipse.jdt.ui.text.codetemplates.constructorcomment"name= "Constructorcomment">/** * Create a new instance of ${enclosing_type}. * * ${tags} */</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">/** * @Title: ${enclosing_method} * @Description: ${todo} (here is a word describing the function of this method) * @param ${tags} parameter * @r Eturn ${return_type} return type * @throws * /</Template>    <TemplateAutoInsert= "true"Context= "Overridecomment_context"deleted= "false"Description= "Comment for overriding methods"enabled= "true"ID= "Org.eclipse.jdt.ui.text.codetemplates.overridecomment"name= "Overridecomment">/* (not Javadoc) *<P>Title: ${enclosing_method}</P>    * <P>Description:</P>* ${tags} * ${see_to_overridden} */</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= "Gettercomment_context"deleted= "false"Description= "Comment for getter Method"enabled= "true"ID= "Org.eclipse.jdt.ui.text.codetemplates.gettercomment"name= "Gettercomment">/** * @return ${bare_field_name} * *</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> </Templates>

Eclipse Comment template settings in detail

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.