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.AbstractValueMetaData; 28 import org.jboss.beans.metadata.plugins.StringValueMetaData; 29 import org.jboss.xb.binding.sunday.unmarshalling.DefaultElementHandler; 30 import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; 31 import org.xml.sax.Attributes ; 32 33 39 public class ValueHandler extends DefaultElementHandler 40 { 41 42 public static final ValueHandler HANDLER = new ValueHandler(); 43 44 public Object startElement(Object parent, QName name, ElementBinding element) 45 { 46 return new AbstractValueMetaData(new StringValueMetaData()); 47 } 48 49 public void attributes(Object o, QName elementName, ElementBinding element, Attributes attrs, NamespaceContext nsCtx) 50 { 51 AbstractValueMetaData value = (AbstractValueMetaData) o; 52 StringValueMetaData string = (StringValueMetaData) value.getValue(); 53 for (int i = 0; i < attrs.getLength(); ++i) 54 { 55 String localName = attrs.getLocalName(i); 56 if ("class".equals(localName)) 57 string.setType(attrs.getValue(i)); 58 } 59 } 60 } 61 | Popular Tags |