Convert to Instance Method
ClassB residing in the same package.
MyClass contains the following code:
Converting a method to an instance method
- In the editor, place the caret on the declaration or usage of a method to be refactored. The method should be static and the types of its parameters should be the classes from the project. In other words, you cannot use such parameters types, as
- Do one of the following:
- The Convert to Instance Method dialog appears.
- In the Select an instance parameter list 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.
- To change the visibility scope of the converted method, select the new scope in the Visibility area. By default the converted method will have no scope declaration (equivalent to public ).
- Preview and apply changes.
Last modified: 18 July 2017