Vlad the Impala
Vlad the Impala

Reputation: 15872

Putting Nested Classes In Separate Files

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?

Upvotes: 6

Views: 3971

Answers (3)

Nikita Rybak
Nikita Rybak

Reputation: 68006

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.

Upvotes: 3

BalusC
BalusC

Reputation: 1108732

Use the right tools.

alt text

Upvotes: 11

ocodo
ocodo

Reputation: 30248

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.

Upvotes: 1

Related Questions