Reputation: 1496
I'm quite confused as to why the annotation won't create getter methods for the variables if the annotation is at class level
@Getter
public class Config {
private static final String TEST = "";
}
But creates the getters if annotation is at the variable level.
public class Config {
@Getter
private static final String TEST = "";
}
Thank you!
Upvotes: 3
Views: 2881
Reputation: 488
You can do this as the documentation says:
You can annotate a class with a @Getter or @Setter annotation. Doing so is equivalent to annotating all non-static fields in that class with that annotation. @Getter/@Setter annotations on fields take precedence over the ones on classes.
The problem you're seeing is because the field you're having problems with is static
.
Upvotes: 2