IntelliJ IDEA 13.1 Web Help

Refactor | Extract | Parameter

Use this dialog to specify the options and settings related to the extracting parameters.

Item Description
Parameter of type Specify the type of the new parameter. Usually, you don't need to change the type suggested by IntelliJ IDEA.
Name Specify the name for the new parameter.
Replace all occurrences Select this option to replace all the occurrences of the selected expression within the method.
Declare final Select this option to declare the parameter final.
Delegate via overloading method Select this option to keep the existing method calls unchanged.

As a result, a new overloading method will be created and the new parameter will be added to the definition of this method. The method with the old signature will be kept. The call to the new method will be added to the old method. The necessary value (or expression) will be passed to the new method in this call. See code examples.

The following options are available if the expression contains a direct call to a class field that has a getter.
Do not replace Select this option to use a direct call to the field regardless of the scope context.
Replace fields inaccessible in usage context Select this option to use a call to the getter only where a field is directly inaccessible.
Replace all fields Select this option to use a call to the getter.
The following options are available when the refactored expression contains local variables.
Delete variable definition Select this option to remove the definition of a local variable.
Use variable initializer to initialize parameter Select this option to use the default value of the selected variable in the corrected method calls.

Warning

It is strongly recommended that you select both check boxes. Otherwise, the code may become uncompilable.

See Also

Code Examples:

Procedures:

Web Resources: