Joda - Next Generation Beans |
|
Project
Joda Time
Joda Primitives
Joda Beans
Contributing
  |
Design overviewThe designThe Joda framework's public API is defined principally as interfaces. These are modelled around the concepts of JavaBeans, but with enhanced capabilities. Bean
public interface Person extends Bean { StringProperty surname(); String getSurname(); void setSurname(String surname); } Note that for simple beans, there is no need to write a class, just the interface. The class is generated at runtime using the Java 1.3 Proxy class. In the future, Apache BCEL could be used to provide even better runtime code generation. Property
External functionsBuilding upon the Bean and Property classes are external functional classes. Currently these have been developed in the areas of SAX reading and writing, Swing bindings and XPath access. For example, to output the Person defined above as XML use: Person person = (Person) JodaFactory.create(Person.class); person.setSurname("Colebourne"); new XMLOutputter().output(person);This will produce the XML: <Person type="org.joda.Person"> <surname>Colebourne</surname> </Person> The XML handling will cope with beans linked to other beans, including recursive setups, where the XML ID/IDREF functionality is used. A SAXHandler also exists, that can read in the XML document and recreate the Bean. In particular, the XML handling will manage numbers, booleans and dates, converting to and from strings. Other features
|
Last updated 31st January 2004.
Website and development hosting by SourceForge.
Copyright (c) 2001-2004 Stephen Colebourne. All rights reserved.
Java and JavaBeans are trademarks of Sun Microsystems.