Search in sources :

Example 1 with MapMetadataImpl

use of org.apache.aries.blueprint.reflect.MapMetadataImpl in project aries by apache.

the class Parser method parseMap.

public MapMetadata parseMap(Element element, ComponentMetadata enclosingComponent) {
    // Parse attributes
    String keyType = element.hasAttribute(KEY_TYPE_ATTRIBUTE) ? element.getAttribute(KEY_TYPE_ATTRIBUTE) : null;
    String valueType = element.hasAttribute(VALUE_TYPE_ATTRIBUTE) ? element.getAttribute(VALUE_TYPE_ATTRIBUTE) : null;
    // Parse elements
    List<MapEntry> entries = new ArrayList<MapEntry>();
    NodeList nl = element.getChildNodes();
    for (int i = 0; i < nl.getLength(); i++) {
        Node node = nl.item(i);
        if (node instanceof Element) {
            Element e = (Element) node;
            if (nodeNameEquals(e, ENTRY_ELEMENT)) {
                entries.add(parseMapEntry(e, enclosingComponent, null, null));
            }
        }
    }
    return new MapMetadataImpl(keyType, valueType, entries);
}
Also used : MapEntry(org.osgi.service.blueprint.reflect.MapEntry) NodeList(org.w3c.dom.NodeList) Node(org.w3c.dom.Node) Element(org.w3c.dom.Element) ArrayList(java.util.ArrayList) MapMetadataImpl(org.apache.aries.blueprint.reflect.MapMetadataImpl)

Aggregations

ArrayList (java.util.ArrayList)1 MapMetadataImpl (org.apache.aries.blueprint.reflect.MapMetadataImpl)1 MapEntry (org.osgi.service.blueprint.reflect.MapEntry)1 Element (org.w3c.dom.Element)1 Node (org.w3c.dom.Node)1 NodeList (org.w3c.dom.NodeList)1