Extract Interface Refactoring Specification
$Id: extractinterface.html,v 1.6 2005/08/11 09:06:51 jbecicka Exp $ (see
full
CVS
history)
This refactoring feature allows to create an interface based on a
given class.
Implementation of this refactoring is tracked in issue
57430.
Pre-Conditions
- A java class or interface is selected.
Pre-Checks
No specific checks.
Parameters
- Name of the new interface.
- Interfaces (that the base class implements or that
the base interface inherits from) that should the new interface extend.
- Public methods and public static fields (from the
base class or base interface) that should the new interface declare.
Fast Parameters Check
No specific checks.
Parameters Check
- [4.2] Error: The entered name for the interface causes a name clash.
Changes To Be Made
- The new interface with the selected methods and
fields is created in the same package as the base class/interface.
- The implements/extends clause of the base class/interface is
updated to include the new interface and to exclude the interfaces that
the new interface extends.
- The selected static public fields are removed from the base class.
Checks During Changes Preparation
No specific checks.
Refactoring UI
Menu item:
Extract Interface...
Action title:
Extract Interface - ClassName
The panel should display a text field for name of the new interface and a
table which includes interfaces that are inherited by the base class/interface and
a public non-static methods and public static fields and static Inner Classes from the base
class/interface. Elements in the table can be checked meaining they
should be included into the selection.
-----------------------------------------------
| Super Interface Name: _NewInterface_______ |
| |
| Members to Extract: |
| ------------------------------------------- |
| | | Member | |
| |-----------------------------------------| |
| | o doJob | |
| | x counter | |
| | o InnerClass | |
| | o implements IFoo | |
| | o implements IBar | |
| | | |
| ------------------------------------------- |
-----------------------------------------------