Eclipse Tip: Creating Getters and Setters

Creating getters and setters are probably the most common methods in
Java. It is trivial to write but is does take some time. Eclipse has a
couple a ways to speed up the process. But strangely I do not see a lot
of developers using this. I know some type very fast and can probably
beat the code generation but for the rest us, here they are.

The first way is useful when you have multiple class level variables for which you require to code getters and setters. Go to Source > Generate Getter and Setter…
either from the main menu or context menu. A dialog will pop up with
all the possible getters and setters. Here you have options to choose
which getters and setters you what to generate, where you what to
insert them, how you what to sort them, what access modifiers you want
to use… You can also choose if you want comments to be generated.
Additionally you can change the code templates to suit your needs.

The second way is useful if you want to generate getter and setter for a variable you just added. Just type set and press Crtl + Space.
Eclipse will give you auto complete options for the setter method. The
same goes for the getter method. Here the methods are created with public access and the comments are generated (or not) based on your project preferences.