I've got a plugin architecture for a Java application I'm working with.
All the examples show:
public class SpecialName implements BaseExtenderClass, ClassB, ClassC {
//Stuff
}
Where "SpecialName" is a name you have to name your class in order for it to be recognized as a plugin, and BaseExtenderClass, ClassB, ClassC are all different API functionality that are extended in that one class to do certain operations. Each one has their own methods that must be implemented.
What I'm wondering is if there is a way in Java I can put ClassB and ClassC in separate files from the BaseExtenderClass with SpecialName, and still have it behave for all intensive purposes as if the original code I listed above.
The code would be a lot neater and more organized I could do this since the plugin I'm writing will actually extend a good 6-8 of the available api interfaces.
If not, I can have one massive file... it just doesn't feel like the right way to do things.
Are you trying to split the interface definitions or the implementation code for them ?
I am assuming that you are saying that you don't want to put the implementation code for all 3 interfaces in the same class but rather need to separate into 2 or more files (classes) because you commented on the potential size.
If this is the case (and I'll assume you have a good reason for doing so), you should be able to create an intermediate class that implements ClassB and ClassC, then inherit from that one.
Something like this...
public class TmpClass implements ClassB, ClassC {
//put implementation for these 2 interfaces here
}
public class SpecialName extends TmpClass implements BaseExtenderClass {
//add implementation for BaseExtenderClass interface here
}