MyEclipse: Format of generated getters/setters

jlaudadio - Jan 15, 2008 - 04:00 PM
Post subject: Format of generated getters/setters
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?

Code:
private String code;
public String getCode() {return this.code;}
public void setCode(String code) {this.code = code;}


[/code]
ernestz - Jan 16, 2008 - 02:50 AM
Post subject: RE: Format of generated getters/setters
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.
jlaudadio - Jan 16, 2008 - 02:20 PM
Post subject: Re: RE: Format of generated getters/setters
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.
jhm - Feb 28, 2008 - 09:39 AM
Post subject: RE: Re: RE: Format of generated getters/setters
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.
All times are GMT - 6 Hours
Powered by PNphpBB2 © 2003-2004 The PNphpBB Group
Credits