-
Notifications
You must be signed in to change notification settings - Fork 273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
immutable: Add support for bean-style accessors #33
Comments
Things to consider to implement apply set/get style:
|
I have the answers
interface Val {
boolean isVal();
}
...
ImmutableValue.builder()
.val(true)
.builder(); Well, now it's ok, auto-detection of style consider that as a bean-style. Then I add an non-mandatory accessor in non-bean style, which will disable bean-style detected previously interface Val {
boolean isVal();
List<String> value();
}
...
ImmutableValue.builder()
.isVal(true) // Oops, setter API for `val` attribute just changed?
.builder(); Maybe it's not a problem, but it's very awkward. I think that annotation should control style to make API more stable.
So now we will construct some infrastructure to handle naming, and let's have it flexible as hell... |
Customization infrastructure now allows to tailor generated immutable types and builders to wide range of style and preferences
|
Our code style currently depends on value types with accessors named "getFoo()" and builders with setters named "setFoo()".
I can emulate the getters in the generated types with @Value.Getters, but the top-level interface then isn't useful (it will be missing the getters).
I can't emulate the setters in generated builders as far as I can tell.
It'd be really nice if we could do something like:
which would generate an ImmutableType with
getFoo()
andgetBar()
, and anImmutableType.Builder
withsetFoo()
andsetBar()
.The text was updated successfully, but these errors were encountered: