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

To enable / disable that Javadoc comments are added to the created methods go to the Code Generation preference page (Window > Preferences > Java > Code Generation) and enable / disable  Create Javadoc comments for methods and types.

Related tasks
Generating getters and setters
Source actions

Copyright IBM Corporation 2000, 2002. All Rights Reserved.