Skip to content
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

Builder construction #186

Open
CfFanDuel opened this issue Aug 13, 2024 · 2 comments
Open

Builder construction #186

CfFanDuel opened this issue Aug 13, 2024 · 2 comments

Comments

@CfFanDuel
Copy link

Given a record named Foo a builder named FooBuilder is generated.

To generate a builder you have to do FooBuilder.builder() which feels a bit long winded and repetitive.

Potential solutions:

  • Make the generated constructor public so we can do new FooBuilder() (which is what the existing static .builder() method wraps)
  • Generate a static method named fooBuilder instead of/or as well as builder. This has the advantage of being able to static import it as currently builder() loses context if you do that.
@CfFanDuel
Copy link
Author

Just realised I can use this option to overwrite it:

boolean publicBuilderConstructors() default false;

So that solves my problem, though I wonder if the default should be true :)

@CfFanDuel
Copy link
Author

Though the above doesn't help with Staged builders as using the public constructor bypasses the staging...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant