Use to add logic when you cannot modify the original source code. Select a class method in the Source Editor and choose Refactor > Introduce Local Extension to open the Introduce Local Extension dialog box.
| Element | Description | 
|---|---|
| Introduce Local Extension for | (read-only) Displays the name of the source class that needs an additional method but cannot be modified. | 
| New Name | Specifies the name of an extension class being created. | 
| Project | Specifies the project in which the extension class is created. | 
| Location | Specifies the folder where you want to store the created extension class. | 
| To Package | Specifies the name of the package where the generated extension class is housed. | 
| Type | Provides the following extension class options to use: | 
| Wrapper | Makes the extension class a wrapper of the original class, which keeps the original instance in one of its private fields. | 
| Subtype | Makes the extension class a subclass of the original class, which uses the extension keyword. | 
| Equality | Provides the following options to set how the equals and hashCodemethods are handled: | 
| Delegate | Delegates to the equalsandhashCodemethods of the original class. | 
| Generate | Generates new equalsandhashCodemethods using the IDE code generator. | 
| Separate | Separates the equalsmethod into two. A new method is added to check if the original class equals the extension class.The Equality field is disabled when Subtype is chosen in the Type field. | 
| Replace original usages with the extension | Replaces all usages of the original class with the new local extension class. | 
Related Topics
Developing Applications with NetBeans IDE,
| Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |