Create getter and setter

This dialog lets select the Getter and Setter methods to create.

Use Generate Getter and Setter 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 Getter and Setter dialog shows Getter and Setters for all fields of the selected type. The methods are grouped by the type's fields.

The names of the getting and setting 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 Generation preference page (Windows > Preferences > Java > Code Generation).

When pressing OK, all selected Getter and Setters are created

Option

Description

Select methods to create

Tree containing Getter and Setter methods that can be created. Getter and Setters are grouped by field. 

Select All

Select all Getters and Setter methods

Deselect All

Deselect all Getters and Setter methods

You can control whether Javadoc comments are added to the created methods with the Automatically add comments for new methods and types option on the Code and Comments tab of the Code Generation preference page. (Window > Preferences > Java > Code Generation)

Related tasks
Generating getters and setters
Source actions

Legal notices