Java News from Saturday, April 29, 2006

Sun has submitted JSR-295, Beans Binding to the Java Community Process. According to the JSR,

Developers who write applications that compose Java Bean components often find themselves writing boilerplate that keeps pairs of properties in sync. PropertyChangeListeners are used to detect changes in the source and target properties and to convert and validate data as it moves between the source and target. For example, a Swing developer might write a half of page of code to keep the "text" property of a JTextField in sync with the "name" property of the selected Customer in a JTable.

This specification will define an API that greatly simplifies connecting a pair of Java Beans properties to keep them in sync. The connection will be configurable: type conversion and validation operations may be applied before updating a property.

For example, to connect a String property to a Date property, a String/Date converter would be used. Similarly, an application that wanted to constrain the legal values for the date property would use a validator.

This API is intended to make connecting Java Bean properties simple. The Swing APIs embody an enormous collection of Java Beans and properties. In order for this JSR to be successful it must meet the needs of Swing's architecture and developers.