Coding style in unified projects (Eclipse Java code format, codetemplate)

Source: Internet
Author: User

In the daily development process in the company, in addition to the need to adhere to the unified coding specifications, but also to write code to do a uniform format,Eclipse provides a format encoding tool, shortcut key is:ctrl+shift+f.

To unify the code style of a project group, it is recommended to use a uniform format profile.

Eclipse supports our custom templates, such as file annotations, class annotations, function annotations, and more. Eclipse has its own template, and we can define it ourselves.

Click:windows-"preference-"java-"code style-"code template, popup the interface shown

Import the custom template by clicking on the Import button, and after the import is successful, review the results in the preview below.

Also select the code template on the left.

Test: Create a new class, such as, be sure to tick generate comments, see the class comments, formatting effects!

2 template references are available:

Format.xml

Datatemplate.xml

Coding style in unified projects (Eclipse Java code format, codetemplate)

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.