* @author Remy Maucherat
*/
public class RelativeOrderingMetaDataParser extends MetaDataElementParser {
public static RelativeOrderingMetaData parse(XMLStreamReader reader) throws XMLStreamException {
RelativeOrderingMetaData ordering = new RelativeOrderingMetaData();
// 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;