Awesome article.
Vihang Shah
52

Thanks for the comment Vihang. Giovani’s suggestion should sort out your problem (I’m not aware if lombok has conditional setters). But depending on your usage, this might be a fitting case for using JSR 303 validations, since it looks like you are restricting a bean’s attribute to match certain criteria. I’ll refer you to baeldung, another great source for Java/Spring related stuff: https://www.baeldung.com/javax-validation