How can I specify a one-argument constructor using Lombok?

Lombok doesn’t let you to specify the fields exactly, but there are 3 annotations to choose from. With

@RequiredArgsConstructor class MyClass {
    private final String param;
    private Integer count;
}

you can get it. An argument is required if it’s not initialized inline and final or @NonNull.

Leave a Comment