Skip to content

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

Closed

Description

@josejulio

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.

Activity

  1. joelittlejohn commented on May 3, 2022

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

  2. added a commit that references this issue on May 5, 2022
    d1a5612
  3. added this to the 1.1.3 milestone on Aug 6, 2022
  4. added a commit that references this issue on Aug 6, 2022
    2d55620
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions