Why Not Use @Data Lombok

Why Not Use @Data Lombok

The reasons for not using this annotation are very similar to the case of @Builder : it allows object creation in invalid state. And how else can you add values to this class if not using the also discussed @Setter ? Use it only if it makes sense to your object that it exists with all empty values.

What is the use of Lombok annotation?

Project Lombok is a java library tool that is used to minimize/remove the boilerplate code and save the precious time of developers during development by just using some annotations. In addition to it, it also increases the readability of the source code and saves space.

What is the use of Lombok plugin?

Introduction to lombok Lombok is used to reduce boilerplate code for model/data objects, e.g., it can generate getters and setters for those object automatically by using Lombok annotations. The easiest way is to use the @Data annotation.

Elena Rostova
Author

Elena Rostova

Elena Rostova holds a Master's degree in Public Health Journalism. She covers groundbreaking medical research, holistic wellness trends, mental health awareness, and nutritional science.