1 22 package org.jboss.kernel.plugins.deployment.xml; 23 24 import javax.xml.namespace.QName ; 25 26 import org.jboss.beans.metadata.plugins.AbstractAnnotationMetaData; 27 import org.jboss.xb.binding.sunday.unmarshalling.DefaultElementHandler; 28 import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; 29 30 36 public class AnnotationHandler extends DefaultElementHandler 37 { 38 39 public static final AnnotationHandler HANDLER = new AnnotationHandler(); 40 41 public Object startElement(Object parent, QName name, ElementBinding element) 42 { 43 return new AbstractAnnotationMetaData(); 44 } 45 46 public Object endElement(Object o, QName qName, ElementBinding element) 47 { 48 AbstractAnnotationMetaData annotation = (AbstractAnnotationMetaData) o; 49 if (annotation.getAnnotation() == null || annotation.getAnnotation().length() == 0) 50 { 51 throw new IllegalArgumentException ("Empty <annotation/> content"); 52 } 53 if (!annotation.getAnnotation().startsWith("@")) 54 { 55 throw new IllegalArgumentException ("<annotation/> content must be a fully qualified annotation type name prefixed with '@'"); 56 } 57 58 return annotation; 59 } 60 } 61 | Popular Tags |