import org.w3c.dom.Element;
public abstract class AbstractCollectionBinding implements Binding {
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);
}
String synchronizedText = XmlUtil.attribute(element, "synchronized");
if (synchronizedText!=null) {
Boolean isSynchronized = XmlUtil.booleanEquals(synchronizedText, Boolean.FALSE);
descriptor.setSynchronized(isSynchronized);
}
List<Descriptor> valueDescriptors = new ArrayList<Descriptor>();
List<Element> elements = XmlUtil.elements(element);
if (elements!=null) {
for (Element valueElement: elements) {
Descriptor valueDescriptor = (Descriptor) parser.parseElement(valueElement, parse, WireParser.CATEGORY_DESCRIPTOR);
if (valueDescriptor!=null) {
valueDescriptors.add(valueDescriptor);
}
}
}
descriptor.setValueDescriptors(valueDescriptors);
return descriptor;
}