public AbstractCollectionBinding(String tagName) {
super(tagName);
}
public Object parse(Element element, Parse parse, Parser parser) {
CollectionDescriptor descriptor = createDescriptor();
String className = XmlUtil.attribute(element,"class");
// verify if the given classname is specified and implements the collection interface
if (verify(className, getCollectionInterface(), parse, parser)) {
descriptor.setClassName(className);
}
Boolean isSynchronized = XmlUtil.attributeBoolean(element, "synchronized", false, parse);
if (isSynchronized!=null) {
descriptor.setSynchronized(isSynchronized.booleanValue());
}
List<Descriptor> valueDescriptors = new ArrayList<Descriptor>();
List<Element> elements = XmlUtil.elements(element);
for (Element valueElement: elements) {
Descriptor valueDescriptor = (Descriptor) parser.parseElement(valueElement, parse, WireParser.CATEGORY_DESCRIPTOR);
if (valueDescriptor!=null) {
valueDescriptors.add(valueDescriptor);
} else {
parse.addProblem("unrecognized element: "+XmlUtil.toString(valueElement));
}
}
descriptor.setValueDescriptors(valueDescriptors);
return descriptor;
}