You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Sweetland, Jesse" <JS...@talk.com> on 2006/09/20 15:52:37 UTC

[PATCH] Betwixt 0.7 - Suppress empty collection tags

Attached is a patch that modifies the isEmptyElement method of
AbstractBeanWriter to consider collective element descriptors as empty if
the collection properties they reference have no elements.  This suppresses
the output of empty wrapper elements.  For example, consider the following
.betwixt file for class Foo:

<info>
  <element name="foo">
    <element name="bars">
      <element name="bar" property="bars"/>
    </element>
    <addDefaults/>
  </element>
</info>

Under Betwixt 0.7, an empty <bars/> element is written even if Foo.getBars()
returns a null or empty collection.  This patch determines that the
collection descriptor for the <bar> element is empty, so all of the children
elements of the <bars> wrapper element descriptor are empty, so the <bars>
element descriptor itself is empty, and is therefore ignored.