analytically / innerbuilder

IntelliJ IDEA plugin which generates an inner builder class

Home Page:https://plugins.jetbrains.com/plugin/7354-innerbuilder/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Customize pattern for creating the Builder

HaAlex opened this issue · 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.