Replace constructor with factory method
| Replace constructor with factory method
This refactoring is available only as an intention action.
The Replace Constructor With Factory Method refactoring lets you hide a constructor and replace it with a static method which returns a new instance of a class.
Place the caret at the class constructor in the editor and press .
From the list of available context actions, select Replace constructor with factory method.
In the editor, specify the name of the factory method.
Before | After |
---|---|
|
|