1 22 package org.jboss.kernel.plugins.deployment.xml; 23 24 import javax.xml.namespace.NamespaceContext ; 25 import javax.xml.namespace.QName ; 26 27 import org.jboss.beans.metadata.plugins.AbstractMapMetaData; 28 import org.jboss.xb.binding.sunday.unmarshalling.DefaultElementHandler; 29 import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; 30 import org.xml.sax.Attributes ; 31 32 38 public class MapHandler extends DefaultElementHandler 39 { 40 41 public static final MapHandler HANDLER = new MapHandler(); 42 43 public Object startElement(Object parent, QName name, ElementBinding element) 44 { 45 return new AbstractMapMetaData(); 46 } 47 48 public void attributes(Object o, QName elementName, ElementBinding element, Attributes attrs, NamespaceContext nsCtx) 49 { 50 AbstractMapMetaData collection = (AbstractMapMetaData) o; 51 for (int i = 0; i < attrs.getLength(); ++i) 52 { 53 String localName = attrs.getLocalName(i); 54 if ("class".equals(localName)) 55 collection.setType(attrs.getValue(i)); 56 else if ("keyClass".equals(localName)) 57 collection.setKeyType(attrs.getValue(i)); 58 else if ("valueClass".equals(localName)) 59 collection.setValueType(attrs.getValue(i)); 60 } 61 } 62 } 63 | Popular Tags |