[jboss-dev] Way to scan for classes that extend or implement

Rémy Maucherat remy.maucherat at gmail.com
Fri Jun 11 05:55:44 EDT 2010


On Fri, Jun 11, 2010 at 1:38 AM, Bill Burke <bburke at redhat.com> wrote:
> Is there a special deployer API for scanning for classes that extend or
> implement a specific interface?

Yes, the web scanning plugin does that, you can use it in a deployer.

import org.jboss.scanning.web.spi.ResourcesIndex;

addInput(ResourcesIndex.class);

ResourcesIndex ri = unit.getAttachment(ResourcesIndex.class);
VirtualFile classpathItem; Class<?> type;
Set classes = ri.getInheritedClasses(classpathItem, type);

I did not verify the actual results yet. For David, I use it for SCI,
which is a Servlet 3 feature, and having to use it with type Object is
also a possibility.

Rémy



More information about the jboss-development mailing list