Eclipse Get set automatically adds comments

Source: Internet
Author: User
Tags rar

JavaBean is usually used when coding, while we often write comments on the field, but the generated Get/set method will not be generated, by modifying the Eclipse source code can be resolved, directly on the example:

    /*** Employee ID*/      PrivateString userid; /*** Get Employee ID *@returnUserID Employee ID*/       PublicString GetUserid () {returnuserid; }       /*** Set Employee ID *@paramUserID Employee ID*/       Public voidSetuserid (String userid) { This. UserID =userid; }  

Find the jar package in Eclipse: Org.eclipse.jdt.ui_*.jar, make a backup

The suffix jar is then changed to RAR,

Find Org.eclipse.jdt.internal.corext.codemanipulation.GetterSetterUtil.class
Replace it with the class file in the attachment, and replace the suffix with the jar for the Eclipse jar package.

Restart Eclipse Settings Annotation style:

Window->preferences->java->codestyle->code templates->comments->getters/setters

Note that the eclipse must be closed when replacing

Open Eclipse/plugins/org.eclipse.jdt.ui_*.jar with WinRAR

Replace Org.eclipse.jdt.internal.corext.codemanipulation.GetterSetterUtil class

Then start eclipse

Getters:

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

Setters:

    /**        * Set ${bare_field_name}       @param  ${bare_field_name} ${bare_field_name}       * /  

Note: The Get/set method is generated by checking the Generate methods comments

OK, success.

In the eclipse3.3/3.4/3.5 test succeeds, if useless restore jar package, find the corresponding version source code to modify.

    • Gettersetterutil.rar (9.1 KB)
    • Download number of times: 26
    • Gettersetterutil_eclipse3.5.rar (9.8 KB)
    • Download number of times: 15

Eclipse Get set automatically adds comments

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.