- On the main menu, choose .
Alternatively, right-click the editor and choose Generate on the context menu, or use Alt+InsertControl N; Control Enter keyboard shortcut. - In the pop-up list that is displayed in the editor, select one of the following options:
- Getter
- Accessor method for getting the current value of the selected fields.
- Setter
- Mutator method for setting specified values to the selected fields.
- Getter and Setter
- Both methods for the selected fields.
- In the Choose Fields to Generate Getters and Setters dialog box, select the desired fields.
Note
If getters and setters for a field already exist, this field is not included in the list.
- Click OK.
Example 1
Consider the following code:
public class MyClass { int aInteger; }
In the Naming section of the Code Generation page, parameter prefix is set to my, and parameter suffix to Param.
After generating the getter and setter the following code will be produced:
public class MyClass { int aInteger; public int getAInteger() { return aInteger; } public void setAInteger (int myAIntegerParam) { aInteger = myAIntegerParam; } }
Example 2
However, if a is specified as a field prefix in the Code Generation page, then it will not take part in the generation of the method and parameter names:
public class MyClass { int aInteger; public int getInteger() { return Integer; } public void setInteger (int myIntegerParam) { aInteger = myIntegerParam; } }

