How to turn off getter/setter only for one instance non-final field? [Project Lombok]
You can use @Getter(AccessLevel.NONE) @Setter(AccessLevel.NONE)
on the field as described on the website.
Disclosure: I am a Lombok developer.
In order to avoid generating Getter/Setter for a specific field, you can use AccessLevel.NONE
, as described in webpage for Getter/Setter
@Data
public class Person {
private String name;
private int age;
@Getter(AccessLevel.NONE) @Setter(AccessLevel.NONE)
private Map<String, String> dialog;
}
EDIT: This answer originally proposed to use AccessLevel.PRIVATE
. The correct approach is to use AccessLevel.NONE
as @Roel_Spilker mentioned in the other answer. But this answer was accepted by the questioner. In order to avoid future confusion, I edited this to use correct approach.