Project Lombok in Java


Java is a very popular language, but it has few drawbacks.

One of the most popular drawbacks is that we still need to write the boilerplate codes like getters, setters, constructor toString method in Java.

Introduction

Lombok comes into the picture of overcoming this drawback in Java which helps remove the boilerplate codes.

It is a very popular library in the Java world.

Uses:

  • Minimizes & removes the boilerplate codes
  • Saves developers precious time by using @data annotations during development
  • Increases the readability of the source code.
  • Saves space.

IDE is one of the alternative options for generating these boiler plate codes but not completely developer friendly.

Lombok on the other hand adds all these boilerplate codes at the compile-time in the “.class” file and not in the source code.

Note: Developers need to install plugin into IDEs to work with Lombok.


Examples of source code with & without Lombok:

1. Without Lombok


2. With Lombok



By Shiva
Java Expert