I want to know if is possible have two or more files for the same class (not different classes). I want this for better organization of the code.
I think that the answer is “No!”, but maybe, someone knows an obscure way to do this.
The idea is having a file that is a configuration GUI called AnalysisConfiguration and another class that does a bridge between the GUI and Apache Commons Configuration(setting from the GUI or loading the configurations to the GUI).
I think the two can be the same class, but I think the code comes dirty mixing the business configuration methods with the “GUI-To-File” methods. I can easily call the second class something like AnalysisConfigurationFileBridge, but the curiosity tell me to search if is possible having the two as same class.
Java does not have ability to code partial classes. Some other languages, for example C#, do. Furthermore, mixins are not supported in Java, so together certain coding patterns become cumbersome. You may find that one part extending the other is sufficient. Otherwise, you can look at various options including byte-code manipulation, meta programming or simply use another JVM language as needed.