Binding Generator

The binding generator tool uses reflection to examine the structure of one or more Java classes, and constructs a default binding definition for the data contained in the classes. Classes specified by the user are handled with <mapping> definitions. References to other classes are followed automatically where possible, and are treated as embedded <structure> definitions in the generated binding.

By default, the binding generator works directly with the fields of the classes. It converts each field name into a corresponding element or attribute name, ignoring common patterns of field name prefixes (such as a leading "m_", "_", or "f"). The type of XML component used for each field is determined as follows: Primitive types are bound to required attributes; Object types corresponding to primitive types, along with special object types such as the different date/time variations, are bound to optional attributes; Strings and other object types are bound to optional elements.

The main limitation of the binding generator relates to handling of collections. The binding generator is unable to determine the type of item which is included in a collection, so it generates the binding on the assumption that the collection items will have <mapping> definitions included in the binding. As a precaution, it prints a warning message to the console giving the field name whenever it encounters a collection and stating that the item classes require mapped implementations.

You can see an example of using the binding generator, and find out about the many binding generator options, in the other pages of this section.