Yaroslav
Yaroslav

Reputation: 1375

Generate getters and setters for inner class. Eclipse

How can I generate getters and setters for inner class in Eclipse? I found only such kind of info. which is not useful for answering my question: that and that.

Upvotes: 0

Views: 1021

Answers (2)

user85421
user85421

Reputation: 29680

Set the cursor in the inner class or over the corresponding field and choose the menu

Source > Generate Getters and Setters...

or shortcut:

Alt+Shift+S> Generate Getters and Setters...

A dialog window should open where you can selected which Getters and/or Setters should be generated.

By default, it is also possible to just type the corresponding method name (e.g. getName) and use autocomplete Ctrl+Space to create the method.

Upvotes: 1

On Windows set the cursor anywhere in the inner class and hit Alt+Shift+S+R. Select the fields you want to generate the setters/getters for. Hit OK.

Apply the same process for the outer class.

Upvotes: 1

Related Questions