Builder pattern code generation in IntelliJ

前端 未结 11 1435
猫巷女王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:48

    If you are wondering if this can be used to create a class with an inner builder class as described by Joshua Block - you just have to define an empty inner class first, then check "Use existing" and search for your newly created (inner class) and hit "Refactor".

    PS! Cursor must reside inside constructor (pre-written) in order to use the "Replace Constructor with Builder" refactoring function.

提交回复
热议问题