Add an option to keep optional object value at its default instead of null
--------------------------------------------------------------------------

                 Key: JIBX-418
                 URL: http://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.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
jibx-devs mailing list
jibx-devs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-devs

Reply via email to