Joda-Beans provides a small framework that adds properties to Java, greatly enhancing JavaBeans. The key concept is to allow each property on a bean to be accessed as an object. This enables technologies such as XPath, XML conversion, DB mappings, WebApp validation and Swing bindings.
Version 0.7.1 was released on 2013-07-22 -
Download now
Joda-Beans is licensed under the business-friendly Apache 2.0 licence.
Joda-Beans has been created to plug a gap in the Java language - properties. The concept of properties is familiar to those coding in almost every other modern language. Java stands alone in its pursuit of the terrible JavaBean approach, and personally I believe that properties should have been added to Java before generics and closures.
JavaBeans are typically created by manual coding or one-off IDE generation, such as by Eclipse. The same approach is taken to the creation of equals and hashCode methods. However, none of these approaches provides for a simple and fast mechanism to query a bean for the properties it exposes.
Joda-Beans provides a solution. As a developer, you just write the fields much as you would today. Then you add annotations to the bean and properties. Finally, you run a code generator, which creates the get/set methods plus framework methods that allow the properties to be effectively queried. A key point is that the code generator may be run again and again on the Java file, and is non-destructive.
See these sample classes used for testing - basic Person class, example usage, example of validation.
Various documentation is available:
There are no full releases yet! Release 0.7.1 is the current development release intended for feedback. The code is fully tested, but there may yet be bugs and the API may yet change. There should be no great reason why it cannot be used in production if you can cope with future API change.
The project runs on JDK 1.6 and requires Joda-Convert. There are a number of optional dependencies which help with integration.
Available in the Maven Central repository.
Please use GitHub issues and Pull Requests for support.