Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OSGi: Get list of classes in package

Tags:

osgi

Is it possible to find all classes or interfaces in a given package? There is no simple way to do it in "plain Java", but OSGi probably does a better job, doesn't it?

like image 221
JBaruch Avatar asked May 02 '11 10:05

JBaruch


1 Answers

The answer is yes starting in 4.3. A new API has been added:

BundleWiring.listResources(String path, String filePattern, int options)

which can be used to scan the class path of a bundle. With the appropriate parameters, you can get the names of all the classes in a package.

like image 55
BJ Hargrave Avatar answered Jan 26 '23 10:01

BJ Hargrave