Khawar Ali Khawar Ali - 10 months ago 66
Java Question

Maintain naming standard for variables with Lombok @Getter AND @Setter

The code base I work with uses the naming standard for every local variable to start with an 's' or and 'f' e.g. fName or sName. When I use Lombok @Getter annotation with it, it ends up naming the functions as getFName() or getSName() which doesn't look pretty.

Do you have any advice or suggestions on how you guys maintain the naming guidelines/standards while using Lombok?

Answer Source

Create a lombok.config file in your project root with the following contents:

lombok.accessors.prefix += f
lombok.accessors.prefix += s

See here for lombok.accessors.prefix parameter description and here for instructions on lombok.config file usage.

Or better, if at all possible, get rid of this naming convention altogether.