I have a file with nested classes, but it's becoming long enough to be unreadable. Is there a way I can break out the nested classes into separate files?
Asked
Active
Viewed 3,908 times
3 Answers
11
Use the right tools.

BalusC
- 1,082,665
- 372
- 3,610
- 3,555
-
4NetBeans: Right click class -> Refractor -> Move Inner to Outer Level – TheLQ Sep 05 '10 at 05:31
-
...although technically this isn't what I asked for (as Nikita pointed out), this is in fact what I wanted. – Vlad the Impala Sep 05 '10 at 05:34
-
Or press F6 when your cursor is over the class name in IDEA, which is the right tool. – Ricky Clarkson Sep 05 '10 at 05:38
3
I'm afraid not.
As an alternative, you could consider converting some of them to plain Java classes: although nested classes increase encapsulation, you can certainly create good OO design without them.
My two cents.

Nikita Rybak
- 67,365
- 22
- 157
- 181
1
Write unit-tests to cover the code you are going to refactor.
Then use refactoring tools, e.g. Eclipse/JDT to extract each class. Run the tests for each refactoring job.
For extra fun, you can do this without the unit tests.

ocodo
- 29,401
- 18
- 105
- 117