cornercorner
FeaturesPluginsDocs & SupportCommunityPartners

Extract Superclass Refactoring Specification

$Id: extractsuperclass.html,v 1.7 2007/06/25 14:03:40 jpokorsky Exp $ (see full CVS history)

This refactoring feature allows to create a new class based on a given (base) class. The new class is superclass of the base class.
Implementation of this refactoring is tracked in issue 57479.

Pre-Conditions

  1. A java class is selected.

Pre-Checks

No specific checks.

Parameters

  1. Name of the new class.
  2. Interfaces (that the base class implements) that should the new class implement.
  3. Protected and public methods and fields (from the base class or base interface) that should declared as abstract in the new class.

Fast Parameters Check


No specific checks.

Parameters Check

  1. [4.2] Error: The entered name for the new class causes a name clash.

Changes To Be Made

  1. The new class with the selected methods and fields is created in the same package as the base class. The new class is abstract in case of extracting an abstract method or an interface from the implements clause or in case of an abstract superclass and not selecting all implementation methods to extract. If the base class extends a class, the new class will extend this class (extended by the base class). Moreover, the new class implements all interfaces selected from the base class.
  2. The implements and extends clauses are updated. The base calss should extend the new class and all interfaces that were selected are removed from the implements clause.
  3. The selected public and protected fields are removed from the base class.

Checks During Changes Preparation

No specific checks.

Refactoring UI

Menu item: Extract Superclass...
Action title: Extract Superclass - OldClass

The panel should display a text field for name of the new class, a table which contains of interfaces that are implemented by the base class and public and protected methods and fields from the base class. Elements in the table can be checked meaning they should be included into the selection.
Make Abstract checkbox will be available only for methods.

----------------------------------------------
| Superclass Name: _NewClass_______________  |
|                                            |
| Members to Extract:                        | 
| ------------------------------------------ |
| |  | Member                |Make Abstract| |
| ------------------------------------------ |
| | o doJob                  |             | |
| | x counter                |             | |      
| | o InnerClass             |             | |
| | o implements IFoo        |             | |
| | o implements IBar        |             | |
| |                          |             | |
| ------------------------------------------ |
----------------------------------------------
Companion
Projects:
MySQL Database Server   GlassFish Community: an Open Source Application Server   Open Solaris  Open JDK: an Open SourceJDK   Mobile & Embedded Community     Sponsored by 
Sponsored by Sun Microsystems