use of org.eclipse.smarthome.config.xml.util.NodeList in project smarthome by eclipse.
the class EventDescriptionConverter method unmarshal.
@Override
public final Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {
List<EventOption> eventOptions = null;
NodeList nodes = (NodeList) context.convertAnother(context, NodeList.class);
NodeIterator nodeIterator = new NodeIterator(nodes.getList());
NodeList optionNodes = (NodeList) nodeIterator.next();
if (optionNodes != null) {
eventOptions = toListOfEventOptions(optionNodes);
}
nodeIterator.assertEndOfType();
EventDescription eventDescription = new EventDescription(eventOptions);
return eventDescription;
}
use of org.eclipse.smarthome.config.xml.util.NodeList in project smarthome by eclipse.
the class StateDescriptionConverter method unmarshal.
@Override
public final Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {
Map<String, String> attributes = this.attributeMapValidator.readValidatedAttributes(reader);
BigDecimal minimum = toBigDecimal(attributes, "min", null);
BigDecimal maximum = toBigDecimal(attributes, "max", null);
BigDecimal step = toBigDecimal(attributes, "step", null);
String pattern = attributes.get("pattern");
boolean readOnly = toBoolean(attributes, "readOnly", false);
List<StateOption> channelOptions = null;
NodeList nodes = (NodeList) context.convertAnother(context, NodeList.class);
NodeIterator nodeIterator = new NodeIterator(nodes.getList());
NodeList optionNodes = (NodeList) nodeIterator.next();
if (optionNodes != null) {
channelOptions = toListOfChannelState(optionNodes);
}
nodeIterator.assertEndOfType();
StateDescription stateDescription = new StateDescription(minimum, maximum, step, pattern, readOnly, channelOptions);
return stateDescription;
}
Aggregations