Java Magic Hall: annotations and Comment templates

Source: Internet
Author: User

Http://www.cnblogs.com/fsjohnhuang/p/3988883.html

First, comments

1. Annotation types

[A]. Single-line Comment

Single-line comment String type = "single line comment";

[b]. Multiline comment

/  * Multi-line comment */string type = "Multiline comment";

[c]. Documentation Comments

/** * Documentation comments */public class dummy{}

2. Shortcut keys

[A]. Add/Cancel a single line comment: ctrl+/

[b]. Add a document comment for the class: ctrl+shift+j

Second, the note template

role: defines the default annotation format for files, classes, and methods, reducing the amount of manual input.

1. Set the entry for the comment template: click window->preference->java->code style->code Template, and then expand The comments node.

2. the elements under the comments node are described below:

file Node (document comment label)

/**   * @Title: ${file_name} * @Package ${package_name} * @Description: ${todo} (describe the file in a word) * @author fsjohnhuang* @da Te ${date} ${time} * @version V1.0   */

Types Node (class comment label)

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

Fields node (field comment label)

constructor Node (constructor comment label)

/** * <p>title: </p> * <p>description: </p> * ${tags} */

method Node (Methods comment label)

Press CTRL + C to copy the code<textarea></textarea>Press CTRL + C to copy the code

overriding Methods node (override method Comment label)

/** Title: ${enclosing_method}*description: * ${tags} * ${see_to_overridden} */

Delegate Methods Node (Proxy method comment label)

Getter Node (Getter Method Comment label)

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

Setter Node (Setter method Comment label)

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

3. Import and Export comment templates

Export comment Templates can be imported under the Window->preference->java->code style->code template.

Respect the original, reprint please indicate from: http://www.cnblogs.com/fsjohnhuang/p/3988883.html ^_^ Fat Boy John

Java Magic Hall: annotations and Comment templates (go)

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.