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

Add builder method to create a new instance of the builder #1396

Closed
josejulio opened this issue Apr 27, 2022 · 1 comment · Fixed by #1401
Closed

Add builder method to create a new instance of the builder #1396

josejulio opened this issue Apr 27, 2022 · 1 comment · Fixed by #1401
Milestone

Comments

@josejulio
Copy link
Contributor

When using (in the context of the maven builder) useInnerClassBuilders and generateBuilders set to true it would be nice to have a builder method to generate a new builder.

i.e.
Instead of:

new MyGeneratedObject.MyGeneratedObjectBuilder()
    .withFoo("bar")
    .build();

Have something like:

MyGeneratedObject.builder()
    .withFoo("bar")
    .build();

It could be an opt-in by a new setting e.g. addBuilderMethodForInnerClassBuilders.

I'm supposing the same applies for the core, but haven't checked all the details other thant the BuilderRule file where I suppose it needs to be modified.

@joelittlejohn
Copy link
Owner

No need for a setting for this. We can add the method in a way that does not break existing code, and I agree it would be nice to include it.

josejulio added a commit to josejulio/jsonschema2pojo that referenced this issue May 5, 2022
@joelittlejohn joelittlejohn added this to the 1.1.3 milestone Aug 6, 2022
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

Successfully merging a pull request may close this issue.

2 participants