I'm trying to figure out if there is a way to set the getter
method name manually using lombok. Consider the following example:
@Getter
@Builder(setterPrefix = "with")
@AllArgsConstructor(access = AccessLevel.PRIVATE)
public class Context {
@Builder.Default
private final boolean logReceivedMessages = false;
... many other fields ...
}
With the above example you are able to build the context like so:
context = Context.builder().withLogReceivedMessages(true/false).build;
and then use it as
if(context.isLogReceivedMessages()) {
XYZ
} else {
zyx
}
The name of the generated method is not really how I would word it and was wondering if there was a way to customize it? Is there an annotation which would allow me to name it to something like shouldLogReceivedMessages()
instead of isLogReceivedMessages
? I can't seem to find that in the docs.