jQuery in Action, 2nd edition*
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


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "refactoring a big class" Watch "refactoring a big class" New topic
Author

refactoring a big class

olze oli
Ranch Hand

Joined: Jun 20, 2009
Posts: 148
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):

Browser.java

Player.java

Downloader.java
olze oli
Ranch Hand

Joined: Jun 20, 2009
Posts: 148
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: http://aspose.com/file-tools
 
subject: refactoring a big class