private static CommandConfig parseCommand(Element element) {
assert element != null;
assert element.getNodeName().equals("command");
CommandConfig commandConfig = new CommandConfig();
String id = DomUtils.getChildElementText(element, "id");
String classname = DomUtils.getChildElementText(element, "command-class");
commandConfig.setId(id);
commandConfig.setClassname(classname);
NodeList propertyList = element.getElementsByTagName("custom-property");
if(propertyList != null) {
for(int k = 0; k < propertyList.getLength(); k++) {
Element propertyElement = (Element)propertyList.item(k);
String propName = DomUtils.getChildElementText(propertyElement, "name");
String propValue = DomUtils.getChildElementText(propertyElement, "value");
CustomPropertyConfig propertyConfig = new CustomPropertyConfig(propName, propValue);
commandConfig.addParameter(propertyConfig);
}
}
return commandConfig;
}