Settings for Eclipse code comments

Source: Internet
Author: User
1. Eclipse User name settings:

Under Eclipse's installation path, open the Eclipse.ini configuration file, as shown in the following figure:

Add under-vmargs:-duser.name= your Name


2. Annotation format and various major profiles

(1). Single line (single-line) Note: "//..."

(2). Block Comment: "/*......*/"

(3). Documentation Comment: "/**......*/"

(4). Javadoc Annotation Label Syntax

@author the description of the class indicates the author who developed the class module

@version the description of the class indicates the version of the class module

@see references to classes, attributes, and methods, which are related topics

@param description of the method for a parameter in the method

@return description of the method to return the value of the method

@exception the description of the method to the exception that the method might throw

@return_type return type

@date Date

@time Time

3 Annotation Additions to classes, methods, overriding methods, and so on

Call: Window->preference->java->code style->code Template and then expand the Comments node, select the type of annotation you want to add,

Then click Edit, which is all the elements you want to set the annotation on. Each element is described individually:

After clicking Edit, press CTRL + "/" in the pattern to select the kind you want to add, such as date, author, time, return type, etc. ...

When set, the corresponding code is generated in the pattern above, as shown in the following illustration:

(1) document (files) Comment Label:

Not currently used, you can not use the settings. (2) type (Types) Comment Label (note for Class):

Specification:

/**

* Description of the class

* @authoryourname

* @Time 2012-11-20 14:49:01

*

*/

Pattern of annotations:

/**

* @Description: ${todo}

* @author: ${user}

* @time: ${date} ${time}

* /(3) field (Fields) annotation Label:

/**
* @Description: ${field}: ${todo} (describe what this variable represents in one sentence)
*/

Not for a while.


(4) constructor tag (constructor):

Specification:

/**

* Description of the construction method

* @param Name

* The text displayed on the button

*/

Pattern:

/**

* @Description: ${todo}

* ${tags}

*/ (5) method (Methods) Label: (Interface and its implementation of the class method, should be annotated)

Annotation specification:

/**

* Add color to the button

*@param Color

The color of the button

* @return

* @exception (with abnormal method)

* @author Administrator

* @Time 2012-11-20 15:02:29

*/

Pattern:

/**

* @Description: ${todo}

* ${tags}

* ${return_type}

* @exception:

* @author: ${user}

* @time: ${date} ${time}

* * (6) Coverage method (overriding Methods) Label: (7) representative method (Delegate Methods) Label:
(8) Getter Method Label:
(9) Setter method Label:

These are temporarily undefined, and you can add comments in your own way.





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.