Convert to Instance Methodrefactoring
Convert to Instance Method refactoring lets you convert a static method to a non-static, class instance method, with a class being the type parameter of the initial method.
- In the editor, place the caret on the declaration or usage of a method that you want to refactor. The method should be
staticand the types of its parameters should be the classes from the project. Also note that you cannot use such parameters types as
- From the main menu, select .
- In the dialog that opens, select the class you want the method to belong to after the conversion. All the usages of this class inside the method are replaced with this.
If you need, change the visibility scope of the converted method.
- Preview and apply changes.
ClassB residing in the same package.
As a result,
ClassB become converted.
| || |