Languages
[Edit]
EN

Lombok private final constructor (java example)

3 points
Created by:
Emrys-Li
380

Quick solution:

@FieldDefaults(level = AccessLevel.PRIVATE, makeFinal = true)

Example:

import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.experimental.FieldDefaults;

@Data
@AllArgsConstructor
@FieldDefaults(level = AccessLevel.PRIVATE, makeFinal = true)
public class AddPostRequest {
    String postName;
    String postBody;
}

 

Lombok - java library

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join