How to Create java Setter Getter method in eclipse automatically

 

This section, I have explained how to create java setter getter method in Eclipse. Click on the following link to know about this Java bean class.

 

Create Setter and Getter Method in Eclipse

 

Create the required Java variables you want setter/getter methods in the java class >> Right click on your Java Class >> Source >> Select Generate Getter and Setters

 

092417_0246_Howtocreate1 How to create java Setter Getter method in Eclipse automaticallly

 

The Generate Getters and Setters window opens >> Click on the button Select All and Click OK

 

092417_0246_Howtocreate2 How to create java Setter Getter method in Eclipse automaticallly

 

This creates the setter/Getter methods like below

 

092417_0246_Howtocreate3 How to create java Setter Getter method in Eclipse automaticallly

 

How to rename a setter/getter method in Eclipse

 

1. Open Windows >> Preferences >> Java >> Uncheck the check box Rename in editor without dialog

 

092417_0246_Howtocreate4 How to create java Setter Getter method in Eclipse automaticallly

 

2. Select a variable you want to rename >> Right click >> Refactor >> Rename

 

092417_0246_Howtocreate5 How to create java Setter Getter method in Eclipse automaticallly

 

3. The Rename Field dialog box appears. Input a name >> Click on the Preview button and Click Ok. All your variable name, references and method names will get renamed

 

092417_0246_Howtocreate6 How to create java Setter Getter method in Eclipse automaticallly

 

How to delete a setter-getter method in Eclipse

 

Click on Windows in the Toolbar >> Show View >> Outline. The Outline Window appears. Right click on the variable and select Delete. That’s it

 

092417_0246_Howtocreate7 How to create java Setter Getter method in Eclipse automaticallly

govindan How to create java Setter Getter method in Eclipse automaticallly
Connect me

Govind

Thank you for visiting my personal blog. Myself Govindan, Software Developer by profession since 2006 and hence I started this blog early in 2016 and ever since I've been writing about technologies experienced and learnings of everyday life.

The views expressed on this blog are my personal views and do not necessarily reflect the views of my employer.

Please feeling free to reach me on any comments and feedbacks you have. Would be more than glad to listen and reply šŸ™‚
govindan How to create java Setter Getter method in Eclipse automaticallly
Connect me
By | 2017-09-23T22:01:15+00:00 September 23rd, 2017|Categories: Eclipse, Java|Tags: |0 Comments
Like us on Facebook.
Connect!