xml-xmlbeans-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Springer, Ian P." <ian.sprin...@hp.com>
Subject generated getters for required (minOccurs="1") sub-elements
Date Mon, 09 Aug 2004 17:50:59 GMT
In xmlbeans 1.0.3, the generated getters/xgetters in an XmlBean for
required sub-elements return null if the corresponding setter has not
been called yet. I'm don't think this behavior is the most logical,
especially for sub-elements that are not nillable. What I'd suggest is
for the getters for required sub-elements to throw an Exception if the
corresponding setter has not been called yet. This would allow code to
distinguish between an element that has not yet been initialized and an
empty element (ie - null). Making it a checked exception wouldn't be a
bad idea either, to remind developers that they need to initialize
required properties in the xmlbean.

Thanks,
Ian

- ---------------------------------------------------------------------
To unsubscribe, e-mail:   xmlbeans-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-dev-help@xml.apache.org
Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/


Mime
View raw message