What is Lombok Data annotation? Lombok Data annotation ( @Data ) Generates getters for all fields, a useful toString method, and hashCode and equals implementations that check all non-transient fields. Will also generate setters for all non-final fields, as well as a constructor.
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 builder?
Project Lombok’s @Builder is a useful mechanism for using the Builder pattern without writing boilerplate code. We can apply this annotation to a Class or a method.