private static List<String> getDatasets(Element datasetsElement) { List<Element> datasetElements = XmlHelper.childElements(datasetsElement, Tag.dataset.toString()); int nDatasets = datasetElements.size(); List<String> datasets = new ArrayList<String>(nDatasets); for (int i = 0; i < nDatasets; ++i) { Element datasetElement = datasetElements.get(i); String dataset = datasetElement.getTextContent(); datasets.add(dataset); } return datasets; }
@Override public Collection call(Element element) { Collection collection = new Collection(); for (Element child : XmlHelper.childElements(element)) { String tagName = child.getTagName(); Tag t = tagLookup.get(tagName); if (t != null) { switch (t) { case id: collection.setId(getLong(child)); break; case name: collection.setName(getText(child)); break; case qname: collection.setQname(getText(child)); break; case description: collection.setDescription(getText(child)); break; case owner_id: collection.setOwnerId(getLong(child)); break; case datasets: collection.setDataSetQnames(getDatasets(child)); break; case deleted: collection.setDeleted(getBoolean(child)); break; default: break; } } } return collection; }