Lombok how to customise getter for Boolean object field?
java, lombok
Solution
It's a bit verbose, but you can provide your own `isXXX`, and then use `AccessLevel.NONE` to tell Lombok not to generate the `getXXX`:
@Data
public class OneOfPaddysPojos {
// ... other fields ...
@Getter(AccessLevel.NONE)
private Boolean XXX;
public Boolean isXXX() {
return XXX;
}
}
(And hey, at least it's not quite as verbose as if you weren't using Lombok to begin with!)
Problem
One of my POJOs has a Boolean object field to permit NULLS in the database (a requirement). Is it possible to use the @Data Lombok annotation at class level yet override the getter for the Boolean field? The default it generates is getXXX method for the Boolean field. I wish to override it as isXXX()? Thanks, Paddy