MyEclipse Forums
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
jlaudadio
Post subject: Format of generated getters/setters  PostPosted: Jan 15, 2008 - 04:00 PM
Registered Member
Registered Member


Joined: May 18, 2006
Posts: 5

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]
 
 View user's profile Send private message  
Reply with quote Back to top
ernestz
Post subject: RE: Format of generated getters/setters  PostPosted: Jan 16, 2008 - 02:50 AM



Joined: Jan 04, 2007
Posts: 137

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.
 
 View user's profile Send private message  
Reply with quote Back to top
jlaudadio
Post subject: Re: RE: Format of generated getters/setters  PostPosted: Jan 16, 2008 - 02:20 PM
Registered Member
Registered Member


Joined: May 18, 2006
Posts: 5

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.
 
 View user's profile Send private message  
Reply with quote Back to top
jhm
Post subject: RE: Re: RE: Format of generated getters/setters  PostPosted: Feb 28, 2008 - 09:39 AM



Joined: Apr 07, 2006
Posts: 61

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.
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT - 6 Hours
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2004 The PNphpBB Group
Credits