I´m trying to add a plugin system to my app. I have an abstract class that plugins must extend. This class provide usuful methods so I really need it. The problem is that these plugins could be written by anyone so I suppouse that they’ll need the abstract class code to be able to compile their code.
I don´t want to complicate the process of creating a plugin. Is there a way to compile the code without know the abstract class body (only its methods)?
Thanks in advance.
No. In order to to compile a class declared as
you’ll have to have
Bin source format in the source path or in .class format on the class path.(If knowing only the methods is sufficient for writing the plugin, it sounds more like you’re after an interface than an abstract class.)
Providing the compiled .class file of
Bis completely uncomplicated and probably the best practice in this scenario.Actually, having an API at hand through a .jar-file containing the relevant classes and interfaces is probably the standard.
To be clear:
pluginapi.jarpluginapi.jarplugin.jar(not necessarily including pluginapi classes)