Extract Delegate
The Extract Delegate refactoring lets you extract some of the fields and methods of a class into a separate, newly created class. This refactoring is useful, when a class has grown too large and "does too many things". In such cases, it might be a good idea to split the class into smaller, more cohesive classes.
Example
To perform Extract Delegate refactoring, follow these steps
- Open the class in the editor, or select it in the Project tool window.
- Select from the main or the context menu.
- In the Extract Class dialog that opens:
- Specify the name and package for the class to be created.
- Selects the fields and methods to be included in the new class.
- Click Preview to see the usages of the selected fields or methods in the Find tool window. Select the usages to be included in the refactoring and click Do Refactor.
Note that this refactoring can also be accessed from a UML Class diagram.
See Also
Reference:
Concepts:
Last modified: 23 November 2016