collectionType.setHandler(new DefaultElementHandler()
{
public Object startElement(Object parent, QName name, ElementBinding element)
{
if (collectionQName.equals(name))
return new AbstractCollectionMetaData();
else if (listQName.equals(name))
return new AbstractListMetaData();
else if (setQName.equals(name))
return new AbstractSetMetaData();
else if (arrayQName.equals(name))
return new AbstractArrayMetaData();
else
throw new IllegalArgumentException("Unknown collection qname=" + name);
}
public void attributes(Object o, QName elementName, ElementBinding element, Attributes attrs, NamespaceContext nsCtx)
{
AbstractCollectionMetaData collection = (AbstractCollectionMetaData) o;
for (int i = 0; i < attrs.getLength(); ++i)
{
String localName = attrs.getLocalName(i);
if ("class".equals(localName))
collection.setType(attrs.getValue(i));
else if ("elementClass".equals(localName))
collection.setElementType(attrs.getValue(i));
}
}
});
configureValueBindings(collectionType);