Add a Java document comment

Source: Internet
Author: User

First, the shortcut keys for add Javadoc comment in Eclipse are:

Shortcut keys are: ALT + SHIFT +j

Second, window-->preferences-->general-->keys; find "add Javadoc comment" To change their favorite shortcut keys.

Third, in addition, if you feel that comments are also uncomfortable when you can also change, modified methods have two kinds:

1. Modify directly under Eclipse-given template

Open Eclipse

Window-->preferences-->java-->code Style---Code Templates---Comments--types---Edit

/**
*
* Project name: ${project_name}
* Class name: ${type_name}
* Class Description:
* Creator: ${user}
* Creation time: ${date} ${time}
* Modified by: ${user}
* Modified: ${date} ${time}
* Modify NOTES:
* @version
*
*/

2. Write an XML document yourself and import it in

Click the Import button on the right to select the template you have written. xml file

The following is a comment line template codetemplates.xml, which can be imported directly using.

The reference code is as follows:

<?xml version= "1.0" encoding= "UTF-8"? ><templates><template autoinsert= "false" context= "cons Tructorcomment_context "deleted=" false "description=" Comment for created constructors "Ena Bled= "true" id= "Org.eclipse.jdt.ui.text.codetemplates.constructorcomment" Name= "Constructo  Rcomment ">/** * Create a new instance ${enclosing_type}.                 * * ${tags} */</template><template autoinsert= "true" context= "Settercomment_context" Deleted= "false" description= "Comment for Setter Method" enabled= "true" id= "Org.eclip Se.jdt.ui.text.codetemplates.settercomment "Name=" settercomment ">/** * @param ${param} The ${bare_fiel                 D_name} to set */</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 is a word describing the effect of this method) * TODO (described here to apply conditions – optional) * TODO (described here for the execution process of this method – optional) * TODO (this describes the use of this method Method – optional) * TODO (note here for instructions on this method – optional) * @param name * @param @return settings file * @return String DOM Object * @Excep tion Exception Object * @since codingexample Ver (code example view) 1.1 */</template><template autoinsert= "true" co                  ntext= "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= "Filecomment_context" deleted= "false" description= "Comment for created Jav                A Files " Enabled= "true" id= "Org.eclipse.jdt.ui.text.codetemplates.filecomment" Name= "Filecomment" & gt;/** * file name: ${file_name} * * Version information: * Date: ${date} * Copyright © ${year} * */</template>&                 Lt;template autoinsert= "false" context= "Gettercomment_context" deleted= "false" Description= "Comment for getter Method" enabled= "true" id= "org.eclipse.jdt.ui.text.co Detemplates.gettercomment "Name=" gettercomment ">/** * ${bare_field_name} * * @return the ${bare_fie Ld_name} * @since codingexample Ver (code example view) 1.0 */</template><template autoinsert= "true" co ntext= "Overridecomment_context" deleted= "false" description= "Comment for overriding method                 S "enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.overridecomment " Name= "Overridecomment">/*** (Non-javadoc) * ${see_to_overridden} */</template><template autoinsert=" false "Contex                 t= "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 means in a sentence) * * @since Ver 1.1 */</template><template autoinsert= "false" context= "Typecomment_context" deleted= "false" description= "Comment for Create                 D types "enabled=" true "id=" Org.eclipse.jdt.ui.text.codetemplates.typecomment " Name= "Typecomment" >/** * Project name: ${project_name} * class name: ${type_name} * Class Description: * Creator: ${user} * Creation time: ${date} ${ti ME} * Modified by: ${user} * Modified: ${date} ${time} * Modified NOTE: * @version * */</template></templates> 

  

Reference article: http://blog.csdn.net/helloanyone/article/details/6233540

Add a Java document comment

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.