facebook

Format of generated getters/setters

  1. MyEclipse Archived
  2.  > 
  3. General
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #280718 Reply

    jlaudadio
    Member

    Hi,

    Not strictly a MyEclipse question but this is the offtopic area so….

    Is there any way to get eclipse to generate getter/setter methods in the following format?

    private String code;
    public String getCode() {return this.code;}
    public void setCode(String code) {this.code = code;}
    #280741 Reply

    ernestz
    Member

    This is a basic Eclipse feature …

    While editing the class for which you want to generate getters/setters, right click mouse and select Source -> Generate Getters and /Setters. Select the properties for which you want to generate getter and/or setter.

    #280751 Reply

    jlaudadio
    Member

    @ernestz wrote:

    This is a basic Eclipse feature …

    While editing the class for which you want to generate getters/setters, right click mouse and select Source -> Generate Getters and /Setters. Select the properties for which you want to generate getter and/or setter.

    Maybe I wasn’t clear enough. I know how to have eclipse generate these methods. My question is about the format of the generated code.

    #282244 Reply

    jhm
    Member

    When you start the getter/setter-generation the Eclipse wizard has a link to the right preference section at the bottom. They are defined in the “Java Code Style > Code Templates”. There you could enable project settings and change the templates for Comments.Getters, Comments.Setters, Code.Getter_Body and Code.Setter_Body. But after generation the code formatter will does his work – so you’ll get line breaks after the brackets.

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: Format of generated getters/setters

You must be logged in to post in the forum log in