Java Reference
In-Depth Information
As is—
No changes are made to the JavaDoc. If present in the class, it stays
there, and the interface has no JavaDoc entries.
■
Copy—
Any JavaDoc found on the class methods is duplicated in the
interface.
■
Move—
Any JavaDoc found on the class methods is deleted and moved
into the interface.
■
Creating hierarchy by introducing a superclass
The
Extract Superclass
refactoring operation is very similar to the
Extract Inter-
face
command discussed earlier. However, instead of creating a new interface, the
refactoring creates a new base class for the current class. Any methods in the cur-
rent class can be moved into the base class with their implementation intact or as
abstract methods, leaving the implementation in the existing class.
Begin by executing the
Refactor | Extract Superclass
command; the
Extract
Superclass
dialog appears, as shown in figure 9.24. In this example, you're creat-
ing a new base class for the
FixedRateCurrencyExchangeService
class from the
previous example. If you want, you can then use the
Extract Interface
refactoring
on the superclass to separate the interface from the base implementation class.
Figure 9.24 The Extract Superclass refactoring works much like the
Extract Interface refactoring, except the former is usually used to define
base classes as opposed to interfaces.