public PropertyBinding() {
super("property");
}
public Object parse(Element element, Parse parse, Parser parser) {
PropertyOperation propertyOperation = new PropertyOperation();
if (element.hasAttribute("setter")) {
propertyOperation.setSetterName(element.getAttribute("setter"));
} else if (element.hasAttribute("name")) {
propertyOperation.setPropertyName(element.getAttribute("name"));
} else {
parse.addProblem("property must have name or setter attribute: "+XmlUtil.toString(element), element);
}
Element descriptorElement = XmlUtil.element(element);
if (descriptorElement!=null) {
Descriptor descriptor = (Descriptor) parser.parseElement(descriptorElement, parse, WireParser.CATEGORY_DESCRIPTOR);
if (descriptor!=null) {
propertyOperation.setDescriptor(descriptor);
} else {
parse.addProblem("couldn't parse property content element as a value descriptor: "+XmlUtil.toString(element), element);
}
} else {
parse.addProblem("property must have 1 descriptor element out of "+parser.getBindings().getTagNames(WireParser.CATEGORY_DESCRIPTOR)+" as content: "+XmlUtil.toString(element), element);