org.java.plugin.extension.annotations.scanner
Class AnnotationDB

java.lang.Object
  extended by org.java.plugin.extension.annotations.scanner.AnnotationDB
All Implemented Interfaces:
java.io.Serializable

public class AnnotationDB
extends java.lang.Object
implements java.io.Serializable

The class allows you to scan an arbitrary set of "archives" for .class files. These class files are parsed to see what annotations they use. Two indexes are created. One is a map of annotations and what classes use those annotations. This could be used, for example, by an EJB deployer to find all the EJBs contained in the archive Another is a mpa of classes and what annotations those classes use. Code is boroght from http://bill.burkecentral.com/2008/01/14/scanning-java-annotations-at-runtime/

Version:
$Revision: 1 $
Author:
Bill Burke, Thasso Griebel (Thasso.Griebel@gmail.com)
See Also:
Serialized Form

Constructor Summary
AnnotationDB(PluginDescriptor plugin)
           
AnnotationDB(PluginDescriptor plugin, java.util.List<Extension> extensions)
           
 
Method Summary
 java.util.List<Extension> getExtensions()
           
 boolean isLoaded()
           
 void scanArchives(java.net.URL... urls)
          Scan a url that represents an "archive" this is a classpath directory or jar file
 void scanClass(java.io.InputStream bits)
          Parse a .class file for annotations
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnnotationDB

public AnnotationDB(PluginDescriptor plugin,
                    java.util.List<Extension> extensions)

AnnotationDB

public AnnotationDB(PluginDescriptor plugin)
Method Detail

getExtensions

public java.util.List<Extension> getExtensions()

scanArchives

public void scanArchives(java.net.URL... urls)
                  throws java.io.IOException
Scan a url that represents an "archive" this is a classpath directory or jar file

Parameters:
urls - variable list of URLs to scan as archives
Throws:
java.io.IOException

scanClass

public void scanClass(java.io.InputStream bits)
               throws java.io.IOException
Parse a .class file for annotations

Parameters:
bits - input stream pointing to .class file bits
Throws:
java.io.IOException

isLoaded

public boolean isLoaded()


Copyright © 2010. All Rights Reserved.