Builder pattern code generation in IntelliJ

前端 未结 11 1237
猫巷女王i
猫巷女王i 2021-01-30 01:36

Is there any way to automate writing Builder patterns in IntelliJ?

For example, given this simple class:

class Film {
   private String title;
   private         


        
11条回答
  •  孤城傲影
    2021-01-30 01:56

    The IntelliJ way to to this is, IMHO, is convoluted. There are out there two plugins (I prefer this one: https://plugins.jetbrains.com/plugin/7354) that serve the purpose much much better.

    For example, I prefer having the Builder class as an inner class of the PoJo. To achieve that with IntelliJ you need few extra strokes.

    Another plus for the plugin is the location of the functionality (in the Generate... context menu).

提交回复
热议问题