How to Generate Getters and Setters for Java Class using VS Code
Contents
Coming from other editors I was looking for way to add getters and setters from the drop-down menus at the top of the screen/window. This is not how it’s done in Visual Studio Code.
How to generate Getters and Setters for a Java Class using VS Code
-
Go to the open project and file in VS Code.
-
Right click in the text of the editor window for .java class file you want to auto generate getters and setters for.
-
Select
Source Action... -
Then from the drop-down Select
Generate Getters and Setters... -
Now click the top checkbox to select all or pick and choose which variables to generate getters and setters for by checking next to the variables you want getters and setters generated for.
-
Press ‘OK’