commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robert burrell donkin <robertburrelldon...@blueyonder.co.uk>
Subject Re: betwixt - java.util.List read/write problems
Date Thu, 24 Apr 2003 08:54:58 GMT
On Monday, April 14, 2003, at 07:40 AM, Randall Lucas wrote:

> Hi Betwixters,

hi Randall

<snip>

> WRT point (2.) below, note that having the adder method in the root Bean 
> type does /not/ fix the fact that writeEmptyElements == false seems to 
> prevent the List from being written entirely.

this is a bug. i've now committed a fix. if you upgrade to CVS HEAD or 
wait until the next nightly build then it should be fixed.

- robert

> Best,
>
> Randall
>
> On Monday, April 14, 2003, at 12:49 AM, Randall Lucas wrote:
>
>> Hi Betwixt users/developers,
>>
>> Please advise if these are novice usage issues (and if so, suggested 
>> resolutions) or if I should enter these as bugs:
>>
>> 1. I can't seem to get Betwixt to read in a nested set of beans 
>> contained in a java.util.List, although it does write out just fine.  
>> What happens is that although the beans that are members of the List are 
>> properly written out, upon being read back in, the List-level collection 
>> wrapper element is marked as empty.  This seems to be the case whether 
>> or not I have writeIDs enabled, whether I use the wrapper element or no 
>> wrapper.
>>
>> class Dataset {
>> 	String getShortName / setShortName(String shortName);
>> 	List getColumns / setColumns (List columns);
>> }
>>
>> processed via:
>>
>>             beanWriter.write(ds); //with writeIDs == false
>>
>> gives:
>>
>>   <Dataset>
>>     <columns>
>>       <Column>
>>         <columnName>someColumnName</columnName>
>>       </Column>
>>       <Column>
>>         <columnName>someOtherColumnName</columnName>
>>       </Column>
>>     <shortName>someDatasetName</shortName>
>>   </Dataset>
>>
>> However, reading back in the output (and subsequently writing it [also, 
>> checking explicitly with getXXX() on the read-in object]) gives me, 
>> again edited for brevity:
>>
>>   <Dataset>
>>     <columns />
>>     <shortName>someDatasetName</shortName>
>>   </Dataset>
>>
>> I am registering the xml paths for the object classes with the bean 
>> reader using "Dataset" for Dataset.class and  "Dataset/columns/Column" 
>> for Column.class.  Ought I to register "Dataset/columns" as a List 
>> somehow?  I've tried registering "Dataset/columns" as an ArrayList 
>> (since that's instantiable) but it gives the same result.
>>
>> I've also tried adding to class Dataset an addColumn(Column column) 
>> method, with no difference in results.
>>
>> 2. A related problem, more likely a dev issue / bug, is that when write 
>> empty elements is set to false, a java.util.List property containing 
>> nested Beans is NOT written out at all.  To draw on the example class in 
>> (1.) above, the output of the first, valid Dataset object doesn't write 
>> any Column objects when writeEmptyElements is false.
>>
>> Best,
>>
>> Randall
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>


Mime
View raw message