commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ed Ward" ...@whatsa.co.uk>
Subject [Betwixt] Collections' element names
Date Mon, 06 Jan 2003 12:32:31 GMT
Individual elements of a collection seem to be named after the class of the
object in the collection. I have a collection of objects that all implement
the same interface, but may be of different types. Is there a way to get
betwixt to output the collection using the name of the interface the objects
are implementing? Similarly if the objects in the collection all extend a
common base class is it possible to have all elements named after the common
base class?

This example is a bit contrived but ..

    public Collection getNames()
    {
        Collection c = new ArrayList();
        c.add("janet");
        c.add(new StringBuffer("john"));
        return c;
    }

will produce something like ..

<names>
    <String>janet</String>
    <StringBuffer>john<StringBuffer>
</names>

is it possible to get betwixt to output ..

<names>
    <String>janet</String>
    <String>john<String>
</names>




Mime
View raw message