Avoid java verbose code for Setters and Getters with anotations (Java)

There are times where your class needs to have several properties along with their setters and getters, this is ok, you can just auto generate them with eclipse, but your code at the end of the day will be full of a lot of verbose lines of code for those Getters and Setters.

In order to avoid this there is a Project called Lombok, they made a library to create Setters and Getters with Java annotations, at the beginning I was skeptical about this, but when I implemented on our Enterprise application, realized that it works as expected, and the good thing is that is integrated with eclipse out of the box, and the only requirement for your project is add this on your Java classpath.

The code looks like this, eclipse compile the code for you and display the generated setters and getters on the outline for you.


Just take a look at  Lombok and check the Demo Video, setters and getters are just a single feature, they have more that this.

I have used this inside my ATG application, just needed to add the .jar into MAINFEST.MF along with the Java classpath.

Comments