Generating getters and setters

The Java editor allows you to generate accessors ("getters and setters") for the fields of a type inside a compilation unit.

  1. In the editor, select the field for which you want to generate accessors (or a type in which you want to create these methods).

  2. Select Generate Getter and Setter from the Source pop-up menu.

  3. A dialog will open to let you select which methods you want to create.

  4. Select the methods and press OK.

Related concepts

Java editor
Java projects

Related tasks

Using the Java editor
Creating a class in an existing compilation unit

Related reference

Generate Getter and Setter
Outline view for Java

Legal notices