[ https://jira.codehaus.org/browse/JIBX-418?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=276625#comment-276625 ]
Klaus Claszen commented on JIBX-418: ------------------------------------ The behavior to set lists of optional collections to null seems to be a bug since version 1.2.3. I opened a bug (JIBX-449) on this and would be glad to hear some official statement. > Add an option to keep optional object value at its default instead of null > -------------------------------------------------------------------------- > > Key: JIBX-418 > URL: https://jira.codehaus.org/browse/JIBX-418 > Project: JiBX > Issue Type: Wish > Components: BindGen, core > Reporter: Markus Sunela > > Currently it is possible to specify that an element or an attribute is > optional. If it's optional and no value is specified in XML then for basic > types the value is left as is (unless a default value is given in binding) > but for Object types value is set to null. It would be really useful, if it > was possible to have an setting that enables leave the Object value untouched > if it's optional and no value is given in XML. Classical example would be: > class Foo { > String name = "foo"; > List values = new List(); > } > <mapping class="Foo"> > <value name="name" field="name"; > <collection name="values" field="values" usage="optional"/> > </mapping> > Now when XML is read, values field is set to null if no values element was > given in XML. Then user has to handle somehow the situation of list being > null in the code, which clutters the code. This kind of situations can happen > easily, for example when extending already existing schemas and wanting to > preserve compatibility with older versions. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira ------------------------------------------------------------------------------ uberSVN's rich system and user administration capabilities and model configuration take the hassle out of deploying and managing Subversion and the tools developers use with it. Learn more about uberSVN and get a free download at: http://p.sf.net/sfu/wandisco-dev2dev _______________________________________________ jibx-devs mailing list jibx-devs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-devs