You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Ashwath Murthy <as...@gmail.com> on 2007/01/15 10:36:33 UTC
Betwixt - Suppress empty collections
Hi,
I read up on the Betwixt changelog that it now supports suppression of empty
collections. Am not able to obtain this functionality though. Here's a code
snippet:
public class Something {
ArrayList persons = new ArrayList();
ArrayList cities = new ArrayList();
ArrayList temps = null;
public Collection getTempCollection() {
return temps;
}
public void addTemp(Person p) {
temps.add(p);
}
//adders and getters for the other two
// beanWriter configuration:
beanWriter.setWriteEmptyElements(false);
beanWriter.getBindingConfiguration().setValueSuppressionStrategy(
ValueSuppressionStrategy.SUPPRESS_EMPTY);
When I write out the XML with some sample data, this is what I see...
<?xml version='1.0' ?>
...............................
<person>
<name>p1</name>
<number>1</number>
</person>
</personCollection>
<tempCollection/>
</Something>
Can someone please help explain why I still see the <tempCollection/> tag??
Cheers!!