Project Lombok is a small project which makes use of annotations to save you from some boiler plate code which in most normal scenarios is largely redundant.
I originally found Lombok when I was tired of adding getters and setters to my POJOs that in the most common case were a very verbose way of just saying I wanted to be able to get and set a list of variables. Lombok adds Getter and Setter annotations which you can apply to a field and it will add a getter and setter method to the class file for you. They’ve taken this a step further though and added a class level @Data annotation so instead of annotating each method twice you can annotate your class once to say that getters and setters should be created:
@Data
public class Main {
private Long id;
}
This not only removes a lot of otherwise redundant code, but it means that when you do choose to define a getter which does something a little out of the ordinary then these differences are now clear to see, instead of being lost in a sea of standard getters and setters.
Take a look at the @Log annotation too as a cleaner way of setting up a logging library. Not all the annotations are worth singing the praises of though, so do be careful and there is one other caveat to this library. Because it makes compile time changes to the code IDEs will have to be made aware that at runtime these additional methods and fields will exist. Download the Lombok jar, double click it and tell it where your IDE installation directory is and it will go and install itself into it. Your Eclipse will now list the getters and setters which you haven’t written!