commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randall Lucas <>
Subject betwixt - java.util.List read/write problems
Date Mon, 14 Apr 2003 04:49:28 GMT
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



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:

     <columns />

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.



View raw message