Alex Rivera | Logout

OSGi: Get list of classes in package

Asked 2011-05-02T10:33:41.510
9

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?

Edit
Report

1 Answer

18

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.

answered 2011-05-02T13:12:32.143

Your Answer