Convert anonymous to inner
Refactor | Convert Anonymous to Inner
The Convert Anonymous to Inner refactoring allows you to convert an anonymous class into a named inner class.
Place the caret within the anonymous class to be refactored.
From the main menu or from the context menu of the selection, select Refactor | Convert Anonymous To Inner.
In the dialog that opens, specify the name for the new inner class and variables that will be used as parameters to the inner class constructor. You can also indicate whether you want to make your class static.
Click OK to create the inner class.
Before | After |
---|---|
|
|
This dialog appears when you invoke the Convert anonymous to inner refactoring.
Item | Description |
---|---|
Class name | Specify here the name for the new inner class. |
Make class static | Use this option to make the new class static. |
Constructor Parameters | In this area select the variables, that will be used as parameters to the inner class constructor. |
Move Up/Down | Use these buttons to reorder parameters. |
Thanks for your feedback!