Hi Jennifer,

My bad on this - it needs to use a built-in custom 
serializer/deserializer. I'll fix this for 1.1.6.

- Dennis

Dennis M. Sosnoski
SOA and Web Services in Java
Training and Consulting
http://www.sosnoski.com - http://www.sosnoski.co.nz
Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117



Jennifer Gau wrote:
> Hello,
>
> In XML a •boolean• can have the following legal
> literals {true, false, 1, 0}.  However, when mapping 1
> to a Boolean (the object), I expect the value to be
> true, but the value is actually set to false.  After
> debugging through the method calls, it appears that
> when using a Boolean, the Boolean constructor is
> called [public Boolean(String s)] and that only
> compares for the strings true/false not 0 and 1.
>
> We can write a custom marshaller to handle the Boolean
> case, but it is a sneaky problem.  If we change a
> variable from boolean to Boolean, the mappings will
> appear to work until we realize the values are off and
> remember to change the mapping to use the custom
> marshaller.  Any tips on a better way to handle this?
>
> Thanks,
>
> -Jennifer
>
> ----------- Code Samples ----------- 
>
> /** Sample Class, the comment denotes the value of the
> variable after unmarshalling */
> public class TestClass {
>       private boolean b1;  //value is set to true
>        
>       private boolean b2;  //value is set to false
>       
>       private boolean b3;  //value is set to false
>       
>       private boolean b4;  //value is set to true
>       
>       private Boolean b5;  //value is set to true
>       
>       private Boolean b6;  //value is set to false
>       
>       private Boolean b7;  //value is set to false
>       
>       private Boolean b8;  //value is set to false !! This
> is not expected.  It should be true
>       
> }
>
> -- Sample XML file --
> <Test>
>       <B1>true</B1>
>       <B2>false</B2>
>       <B3>0</B3>
>       <B4>1</B4>
>       <B5>true</B5>
>       <B6>false</B6>
>       <B7>0</B7>
>       <B8>1</B8>
> </Test>
>
> -- Mapping file --
> <binding name="TestMap" add-constructors="true">
>       <mapping name="Test" class="TestClass">
>               <value name="B1" field="b1"/>
>               <value name="B2" field="b2"/>
>               <value name="B3" field="b3"/>
>               <value name="B4" field="b4"/>
>               <value name="B5" field="b5"/>
>               <value name="B6" field="b6"/>
>               <value name="B7" field="b7"/>
>               <value name="B8" field="b8"/>
>       </mapping>
>       
> </binding>
>
>
>
>       
> ____________________________________________________________________________________
> Shape Yahoo! in your own image.  Join our Network Research Panel today!   
> http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 
>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> jibx-users mailing list
> jibx-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jibx-users
>
>   

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to