norechang / BuilderGenerator

Automatically generate Builder classes instead of using complex constructors, all through the magic of maven.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BuilderGenerator

Automatically generate Builder classes that allow chaining instead of calling every single setter by itself, all through the magic of Maven.

MyDto dto = new MyDto();
dto.setA("a");
dto.setB(2);

MyOtherDto dto2 = new MyOtherDto();
dto2.setSomething(new Object());

dto.setDto(dto2);

list.add(dto);

becomes

list.add(
  MyDtoBuilder.aMyDtoBuilder()
    .withA("a")
    .withB(2)
    .withDto(
      MyOtherDtoBuilder.aMyOtherDtoBuilder()
      .withSomething(new Object())
      .build()
    )
    .build();
);

About

Automatically generate Builder classes instead of using complex constructors, all through the magic of maven.