I'm happy to announce the availability of JBoss Annotations 1.0.0.Alpha1.
JBoss Annotations is a project that will allow you to do annotation scanning of your project and build a repository for these annotations. Furthermore the project will provide various tools that will help in the annotation parsing phase and integration with other JBoss projects.
Why ?
So why did we choose to start yet another annotation scanning project ? The main reason are that we want to have
- A dedicated API for scanning annotations
- A repository that is easy to query
- Integration with JBoss projects, like the JBoss Microcontainer
The last bullet is important since it will allow us to provide an uniform annotation platform when running f.ex. the JBoss Application Server. The project can be used out-side of a JBoss environment, since its dependencies are the Javassist library and JAXB.
Usage
The usage of the library is pretty straight forward :)
// Create an annotation scanner with the default annotation scanning strategy AnnotationScanner as = AnnotationScannerFactory.getDefault(); // URLs to .class and .jar files URL[] urls = ...; AnnotationReposity ar = as.scan(urls); if (ar.hasAnnotation(MyAnnotation.class)) { List<Annotation> l = ar.getAnnotation(MyAnnotation.class); for (Annotation annotation : l) { MyAnnotation myAnnotation = (MyAnnotation)annotation.getAnnotation(); AnnotationType type = annotation.getType(); if (AnnotationType.CLASS == type) { ... } }
You can find out more about the API in the JavaDoc, Users Guide and Developer Guide included in the distribution.
Status
Since this is the first developer snapshot of the project there is a lot to do. So feel free to contact us if you want to help out or to get some of your own ideas into the project :)
We plan to release developer snapshots on a regular basis - basically when a couple of new use-cases has been implemented. So stay tuned for updates !
For Those About to Rock, We Salute You !