File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes OO, Patterns, UML and Refactoring and the fly likes refactoring a big class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "refactoring a big class" Watch "refactoring a big class" New topic

refactoring a big class

olze oli
Ranch Hand

Joined: Jun 20, 2009
Posts: 149
Hi there,

i have a osgi application which uses the EventAdmin bundle from apache to communicate with each module.
I defined a big big enum CommunicationAction which holds all communications like REQUESTSONGFORPLAYER ... and its still getting bigger.
So i thought i refactor it and split the CommunicationAction enum into many, for every module one enum which holds all regarding requests and responses for only that module.
The problem is now that i have some .java files (for every module) containing 2 enums, called Request and Response. The compiler says there is a redefinition of the class Request/Response.
Thats because the enum's are intern used as final classes in the same namespace (if i understand the documentation from the jvm correctly), but i dont want to change the package name nor the Request/Response name.
Is there any way how i can achieve this?

for better understanding:
the package org.dyndns.soundbox.communicationaction contains those files (browser, player, downloader):
olze oli
Ranch Hand

Joined: Jun 20, 2009
Posts: 149
i created a new package eg. communicationaction.browser, communicationaction.player, ... where in everyone is a enum request and response... its not exactly what i wanted, but its ok as solution, as the other approach is impossible...
I agree. Here's the link:
subject: refactoring a big class
It's not a secret anymore!