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

Bill Burke bburke at redhat.com
Fri Jun 11 11:35:47 EDT 2010


Hmmm, where you get the classpathItem from then?  AnnotationIndex 
doesn't require for you to provide this info.

Rémy Maucherat wrote:
> 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
> 
> _______________________________________________
> jboss-development mailing list
> jboss-development at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jboss-development

-- 
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com




More information about the jboss-development mailing list