Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

How To Guides
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Problem Solutions
Privacy Policy




Eclipse Java Development User Guide
Previous Page Home Next Page

Create Getters and Setters

This dialog lets select the getter and setter methods to create.

Use Generate Getters and Setters from the Source menu or the context menu on a selected field or type, or a text selection in a type to open the dialog. The Generate Getters and Setters dialog shows getters and setters for all fields of the selected type. The methods are grouped by the type's fields.

The names of the getter and setter methods are derived from the field name. If you use a prefix or suffix for fields (e.g. fValue, _value, val_m), you can specify the suffixes and prefixes in the Code Style preference page (Windows > Preferences > Java > Code Style).

When pressing OK, all selected getters and setters are created.



Select getters and setters to create

A tree containing getter and setter methods that can be created. Getters and setters are grouped by field their associated field. 

Select All

Select all getter and setter methods

Deselect All

Deselect all getter and setter methods

Select Getters

Select all getter methods

Insertion point

Defines where in the type body the new methods are inserted

Sort by

Defines how to sort the new methods:
  • in getter/setter pairs
  • first getters, then setters

Access modifiers

Defines the access modifiers of the new methods

Generate method comments

Controls whether Javadoc comments are added to the created methods. The comment templates are defined on the Code Templates preference page.

Related reference

Source actions

  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire