Request: configuration flag to omit 'is' prefix from getters for certain boolean fields

368 views
Skip to first unread message

Sander Koning

unread,
Apr 22, 2015, 11:08:59 AM4/22/15
to project...@googlegroups.com
Hi,

In some of our code we have boolean fields with prefixes like 'has' or 'can'. For example hasChildren. When Lombok generates getters for these, the 'is' prefix is added, as per beanspec, resulting in the method isHasChildren().

Would it be possible to add a configuration option to provide a list of prefixes for which this 'is' should not be added? There is already a flag to use 'get' instead of 'is' for booleans starting with 'is' (lombok.getter.noIsPrefix).

Cheers,
--
Sander Koning

Martin Grajcar

unread,
Apr 22, 2015, 3:33:26 PM4/22/15
to project...@googlegroups.com
I was the one with noIsPrefix and I'm pretty sure, it's doable and probably even pretty easy. But are you sure you want it? I see that isHasChildren sounds completely idiotic, but it's beanspec conforming. Similarly strange is getHasChildren or even getReady, however, there's a system in it. And there's also setHasChildren or even setReady, so it's pretty consequent. Never using a prefix (Accessors.fluent=true) is surely consequent, too. What you want is to make it sound better, but imagine you'll need a tool doing some reflection on getters and fields...

Sander Koning

unread,
Apr 23, 2015, 6:55:17 AM4/23/15
to project...@googlegroups.com
There's a system in it, definitely. It's just that our team finds it confusing because isHasSomething, isCanDoThat, isShouldWhatever... reads wrong. It won't conform to beanspec, but we're not beany anyway.

--
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.



--
Sander Koning
Reply all
Reply to author
Forward
0 new messages