Lombok
to write DTOs.
Uses annotations to generate constructors, getters, setters and other methods without needing to write all that boilerplate code.
Example:
@AllArgsConstructor
@ToString
@Getter
public class Customer{
private long id;
private Stringn name;
}
Annotations:
- Constructors
@AllArgsConstructor
@NoArgsConstructor
- Getters / Setters
@Getter
@Setter
- Object methods
@ToString
@EqualsAndHashCode
@Data
:toString()
, getters and setters.@Builder
: Generates a DTO with GoF Design Patterns#Builder.@Value
: Similar to Records