Skip to main content

Introducing JAXB2 reflection project

Posted by kohsuke on August 18, 2005 at 5:00 PM PDT

When you are working with JAXB-bound classes, it's sometimes convenient to be able to parse those JAXB annotations by yourself. For example, some people are interested in implementing a subset of XPath engine on top of JAXB beans; Some other people are interested in writing a Swing JTable adapter for JAXB objects. When doing this kind of stuff, you'd like to know answers for questions like "does this class have a property that maps to attribute name?" or "what's the element name of this class?"

You can do this by looking at JAXB annotations by yourself, but unfortunately JAXB annotations are designed to be easier for users, not for those who want to read it. For example, there's extensive defaulting of annotation parameters. Sometimes annotations are assumed to be implied even if they aren't explicitly present. These things make it easy for users because they don't have to write everything, but on the other hand, to read the annotations correctly, you need to implement a lot of logic.

So it makes sense to use a library that does all that (and more, like error checking.) For this reason, we launched the jaxb2-reflection project today.

This isn't a library for normal JAXB users, but I hope some of you find it useful.

Related Topics >>