[Feature enhancement] includes / excludes parameters on @Getter / @Setter annotations

398 views
Skip to first unread message

Igor

unread,
Feb 4, 2015, 10:35:46 AM2/4/15
to project...@googlegroups.com
Hello,

I noticed that we can use the @Getter / @Setter annotations on a Class level, leading to the generation of getters and setters for all the class fields.

But sometimes, you would like not to generate the getter or setter for one field, because you might have to perform a routine other than a simple "this.field = field". You'll say in that case I can use the annotation on a Field level, but this can be quite tedious if my class have about 10 fields :) .

Don't you think we should have optional parameters like includes or/and excludes to specify which fields should be handled by the annotations?

Let me know your thoughts :).

Thanks.

Reinier Zwitserloot

unread,
Feb 4, 2015, 11:05:49 AM2/4/15
to project-lombok
Just write your getter; lombok will spot that you wrote it yourself and doesn't explicitly generate one. We dislike exclude/of (even though equalsAndHashCode and @ToString does use it) because it's stringly typed, which is bad.

 --Reinier Zwitserloot

--
You received this message because you are subscribed to the Google Groups "Project Lombok" group.
To unsubscribe from this group and stop receiving emails from it, send an email to project-lombo...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Roel Spilker

unread,
Feb 4, 2015, 12:10:37 PM2/4/15
to project...@googlegroups.com
Also it is possible to add @Getter to a class and add @Getter(AccessLevel.NONE) to individual fields you want to exclude.
Reply all
Reply to author
Forward
0 new messages