Magic of Lambok in Java programming

Manpreet Singh
3 min readMar 21, 2022

Java has been one of the most popular programming languages for the past few decades and Java programmers have always been in huge demand. However, one of the major drawbacks of Java has been its verboseness.

As a developer, you must have dealt with boilerplate code that you need to add as a part of the source code such as constructors, getters, setters etc. and which made the code less readable and difficult to manage. We would expect Java to take care of such boilerplate by itself. Some of the new JVM based languages such as Kotlin does include that feature and that is also one of the reasons it is gaining popularity. However, in Java we are still bound to deal with these unnecessary lines of code, until now.

Lombok provides a java library that automatically plugs into your editor and build tools. So you never have to write another getter/setter, constructors or equals method again, and with a single annotation your class has a fully featured builder.

Lambok can be added to your project’s classpath as an external library and you can make use of it in your java classes using an array of annotations that it provides.

Intellij IDE

In order to use it in your Intellij IDE, simply install the plugin as shown below:

Once done, make sure that lambok is added to the project’s classpath


Until now, you would have understood that Lambok makes the life of a developer easy in many ways. How exactly it does that? Let us explore.

Almost all Java projects would have model or entity classes that defines the structure of an object. In our example, we would simply take an example of an ‘Product’ model to illustrate it.

If you look at the file above, you won’t see any boiler plate code. Instead, what you see is a simple entity class ‘Product’ that has 2 properties, id and name. We don’t see any getter and setters, constructors or any…

Manpreet Singh

Software developer who loves writing about programming, technology, passive income strategies etc.