All the 16 Lombok Annotations Explained in a 4-minute article
Explaining each of the 16 annotations in less than 20 seconds. How many of them did you know?
Lombok is a Java library that can generate known patterns of code for us, allowing us to reduce the boilerplate code. In this article, we’ll walk through each of the 16 annotations provided by Lombok and quickly discuss how to use them.
@NotNull
This annotation can be used to validate a constructor or a method parameter. Additionally, if we annotate a field with @NonNull, the validation will be added to the constructor and setter method. Let’s compare the plain-java solution with Lombok’s @NonNull:
@Getter & @Setter
Perhaps the most popular Lombok annotations, @Getter and @Setter can be used to automatically generate getters and setters for all the fields: