analytically/innerbuilder

Customize pattern for creating the Builder

HaAlex opened this issue · 1 comments

Currently the plugin is generating something like this:

public static final class Builder {

        private String foo;
       
        public Builder(){
        }

        public Builder foo (String foo) {
            this.foo = foo;
            return this;
        }

        public MyClass build(){
            return new MyClass(this);
       }

Is is possible to change the setting or customize the plugin to have something like this?:

public static class Builder {

        /** The MyClass to be build */
        private MyClass myClass;
       
        public Builder(){
           myClass = new MyClass();
        }

        public Builder(String foo) {
            this.myClass.setFoo(foo);
            return this;
        }

        public MyClass build(){
             return this.myClass;
       }

Thanks in advance.

This would drastically change behaviour.