Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Setters and Getters
Setters and Getters [message #896358] Wed, 18 July 2012 07:53 Go to next message
Edmund Wong is currently offline Edmund WongFriend
Messages: 2
Registered: July 2012
Junior Member
Hi,

I'm new to Eclipse and am still fiddling with it.

Say I have the following class:

public class TestDog {
private int size;
private String name;

}

Is there a 'feature' in Eclipse that, when I right click(or select) on size,
it automatically creates both the setter and getter for that field? So
it automatically generates the following:

public class TestDog {
private int size;
private String name;

public void setSize( int pSize) { size = pSize; }
public int getSize() { return size; }

public void setName( String pName) { name = pName; }
public String getName() { return name; }

}

with a class that has a few fields, it's ok.. but if there are a lot,
it could be tedious to do that.


Edmund

[Updated on: Wed, 18 July 2012 07:54]

Report message to a moderator

Re: Setters and Getters [message #896360 is a reply to message #896358] Wed, 18 July 2012 07:55 Go to previous message
Edmund Wong is currently offline Edmund WongFriend
Messages: 2
Registered: July 2012
Junior Member
Oh. I just found out that by clicking on the item itself, there's a 'link'
that creates the setter and getter. And under SOurce, there's "Generate
Setters and Getters"..

Sorry for the message.


Edmund

[Updated on: Wed, 18 July 2012 08:02]

Report message to a moderator

Previous Topic:Problem in loading/launching eclipse
Next Topic:Eclipse slides for training
Goto Forum:
  


Current Time: Wed Nov 26 08:08:02 GMT 2014

Powered by FUDForum. Page generated in 0.01869 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software