Project Lombok- Now write less boilerplate code in Java

We, Java Programmers, are tired of writing- Getters, Setters, Constructors, and other boilerplate code or tired of reading this boilerplate code. Often the important logic in the class gets hidden due to these boilerplate code. May be in the coming JDK versions we might have an alternative for these boilerplate code. But till then we have an alternative- Project Lombok which processes the special annotations while you are still writing the code, which means that while you are developing your application- You still have an access to the Getters and Setters or other boilerplate code which is generated by this library. But it comes with its own set of dependencies-  Firstly, its dependent on IDE and  the JDK versions to generate the boilerplate code and to parse the annotations. Secondly, it requires an external JAR to be used. Also people reading the code might not be familiar with the Annotations being used or about Lombok. Though its not hard to learn and with documentation of the code- the person should be able to identify the annotations. Let me take a simple Class- Employee and see how we can use Lombok to make our coding simpler(at least readable to some extent).

Also the Lombok API is well integrated into Netbeans, Eclipse IDEs. So you can download the jar from the site and run the jar to choose which IDE to integrate with Lombok.

Read more

%d bloggers like this: