I am coding on Eclipse. Under a package named com.something.drivers
I've created a number of subpackages containing classes that implement some common interfaces. This is an example of the Driver pattern, so classes under a subpackage will be loaded dynamically from the main application. As all classes in every driver subpackage have the same name, the application can guess the qualified name of a class just after the package name.
Now I am trying to get the list of the installed drivers (subpackages under com.something.driver
package). I don't want to maintain a manually edited list but just get it from the actually installed drivers.
I read List all subpackages of a package and learn how to use Package
class, but I've founded that Package.getPackage(com.something.driver).getPackages()
returns null because the classes in the subpackages under com.something.driver
are only loaded dynamically, and one at a time.
I'm lost at this point. I suppose Package
class is not the way but probably navigate the class tree checking with getResource
?
Thaks in advance.