Navel JavaBean Introspection Tools

Maintained by cmdln

What Is Navel?

Forgive the weak pun but I was struggling for a catchy project name. The purpose of this project is a replacement for the Jakarta Commons BeanUtil library. BeanUtils uses custom class description code and fairly basic Map based dynamic beans, as well as some XML configuration. My view is that the JavaBeans packages provide pretty good metadata and introspection support as is so questioned the decision not to use them, especially since this breaks support for third party tools that might expect standard JavaBeans. I also felt the reliance on XML and Map implementation were inappropriate.

How Navel Works

What Navel does instead is allow you to define a Java interface that describes simple and indexed properties, as supported by the generated BeanInfo from the java.beans.Introspector, and provides a Map based invocation handler that can be tied to the interface with a dynamic proxy. What you get is a lightweight definition with static type safety and the ability to manipulate the bean's value as a simple Map.

My experience is informed by Web development under Java more than anything else, so my unstated goal with this project is to provide dynamic JavaBeans suitable for use with JSP, Servlets, and frameworks like Struts that provide power, flexibility, and type safety. To that end, the API includes release 0.1 contains a PropertyBeanHandler class, as well as a BeanManipulator utility class for describing and populating any kind of standard JavaBean generically and a DelegateBeanHandler which is meant to allow a dynamic property bean to be hooked into a framework by associating delegation targets that provide suitable implementation through additional, non-property specific interfaces.

Version 3.0 represents considerable improvements and testing since the project's inception. It builds on 2.0 which fleshed out indexed property support and extended that to give similar consideration to java.util.List, or more generally sequences. 3.0 made construction and attachment of delegates considerably more flexible and adopted TestNG to replace JUnit. It also added some utilities for traversing JavaBeans of all kinds using dot-path notation. If anyone who has downloaded and is using the library has any feedback, I'm happy to receive it.

The Future

Make sense? Hopefully it will as the project evolves. Check out the example code and the unit tests in the source release to get a sense for how to use the library. The next immediate goal is to get enough real world testing to drive a 1.0 release. After that, I'll return to hacking on the two stated goals above: Struts integration and map/sequence property support.