I have an object with a boolean
property called hasEnoughBalance
, but Spring (or Lombok, or whoever it is) appears to be renaming the getter to isHasEnoughBalance
instead of getHasEnoughBalance
or plain hasEnoughBalance
. How could I prevent that?
I know of @JsonProperty
, but I’d like another solution if possible.
Advertisement
Answer
This is being done by Lombok. One way is to use wrapper Boolean in place of primitive boolean. For primitives, Lombok generates getter appended with is but for wrapper classes, it uses get.