* @author Remy Maucherat
*/
public class AbsoluteOrderingMetaDataParser extends MetaDataElementParser {
public static AbsoluteOrderingMetaData parse(XMLStreamReader reader) throws XMLStreamException {
AbsoluteOrderingMetaData ordering = new AbsoluteOrderingMetaData();
// Handle elements
while (reader.hasNext() && reader.nextTag() != END_ELEMENT) {
final Element element = Element.forName(reader.getLocalName());
switch (element) {
case NAME:
List<OrderingElementMetaData> order = ordering.getOrdering();
if (order == null) {
order = new ArrayList<OrderingElementMetaData>();
ordering.setOrdering(order);
}
NameMetaData name = new NameMetaData();
name.setName(reader.getElementText());
order.add(name);
break;
case OTHERS:
List<OrderingElementMetaData> order2 = ordering.getOrdering();
if (order2 == null) {
order2 = new ArrayList<OrderingElementMetaData>();
ordering.setOrdering(order2);
}
OthersMetaData others = new OthersMetaData();
order2.add(others);
requireNoContent(reader);
break;