Change Method Parameters Dialog Box
See Also
Use this dialog box to specify options for the Change Method Parameters refactoring command.
You can use the Change Method Parameters command to alter the signature of a
method and have those changes propagated in all of the code that calls this method.
Specifically, you can:
- Add and remove parameters to and from a method.
- Reorder the parameters in a method signature.
- Change the access modifier for the method.
You can open the Change Method Parameters
dialog box from the Source Editor, Projects window, or Files window. In one
of these windows, right-click a field and choose Refactor > Change Method Parameters.
The dialog box has the following fields:
- Parameters. Table that contains a list of parameters for the
method. Use the Add, Move Up, and Move Down buttons
to add and rearrange the order of parameters.
Use the Remove button to remove any parameters that you have added
in the dialog box but that you do not want to keep.
The Parameters table has columns for the method
type, name, and default value. Click in a cell to edit a value.
- Press Ctrl-Space to use code completion to choose a parameter type and name.
- Click the ellipsis button on the left of the Type and Return type fields to display the Find Type dialog box.
- Access. Drop-down list containing the four
possible accessibility modifiers (public, protected,
<default>, and private). Select the accessibility
modifier that you want the method to have.
- Return type. Field intended for specifying a method's return type. Press Ctrl-Space to use the IDE's code completion feature.
- Name. Field intended for specifying a method's name.
- Generate Javadoc for this method/Update existing Javadoc of this method. Select to either create or renew the Javadoc for the method in order to reflect most recent changes in the method's parameters.
- Code Generation.
Choose either of the following options:
- Update Existing Method. Select to regenerate the method and incorporate the most recent changes into the method's code.
- Create new Method and Delegate from Existing Method. Select to generate a new delegate method.
- Method Signature Preview. Read-only field that displays
what the method signature will look like if you apply the changes
that you have specified in the dialog box.
If you want to preview the changes, you need to follow these steps
to complete the refactoring:
- Click Preview.
The Refactoring
window opens and displays a tree view of the code to be affected by the refactoring.
- Check the items displayed in the Refactoring window to make sure that you want them
all changed. Clear the checkbox next to any parts of the code that
you do not want changed.
- Click Do Refactoring.
- See Also
- About Refactoring
- Refactoring: Quick Reference
- Undoing Refactoring Changes
Legal Notices