Replace constructor with factory method
AltEnter | 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 AltEnter.
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 |
---|---|
|
|
Thanks for your feedback!
Was this page helpful?