Automatically create builder for class in Eclipse

后端 未结 5 673
离开以前
离开以前 2020-12-24 10:35

Is there a way to use an automatic builder to create builder (Joshua Bloch\'s Builder Pattern) for classes in Eclipse? For example an option in the men

5条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-24 11:29

    You may want to look at lombok annotations to generate builders without the boiler plate code. For example:

    @Builder
    public class MyPojo {
        private String name;
    }
    
    MyPojoBuilder.builder().name("yourame").build();
    

    The limitation is that this doesn't seem to work with abstract classes.

提交回复
热议问题