IntelliJ IDEA 2024.1 Help

Extract Method Object Dialog

Refactor | Extract Method Object

Use this refactoring to extract the method object when the Extract Method refactoring is not applicable because of multiple return values.

Item

Description

Create inner class

Select this option, if you want to extract the method object to an inner class. All the local variables will become fields in that class. Specify the name for the class and visibility scope. You can make the class static, if needed.

Create anonymous class

Select this option to an object with the corresponding method.

Parameters

In this area select the variables that will be used as parameters. Use Move Up/Move Down buttons to reorder parameters/

Last modified: 11 February 2024