Java Lombok in 60 seconds

2 months ago
34

Lombok is a Java library released in 2009. It automatically generates boilerplate code for you.

@Getter - Generates default getters
@Setter - Generates default setters
@ToString - Generates a toString() method that includes all class fields.
@EqualsAndHashCode - Generates equals() and hashCode() methods based on all fields.
@NoArgsConstructor - Generates a no-argument constructor.
@AllArgsConstructor - Generates a constructor with one parameter for each field.
@RequiredArgsConstructor - Generates a constructor with required (final) fields as parameters.
@Data - A shortcut for @Getter, @Setter, @ToString, @EqualsAndHashCode, and @RequiredArgsConstructor.
@Builder - Implements the builder pattern for the class, generating a fluent API for object creation.

Loading 1 comment...