1 17 package org.apache.ws.jaxme.xs.jaxb.impl; 18 19 import org.apache.ws.jaxme.xs.jaxb.*; 20 import org.apache.ws.jaxme.xs.parser.impl.LocSAXException; 21 import org.apache.ws.jaxme.xs.xml.XsEAnnotation; 22 import org.apache.ws.jaxme.xs.xml.XsObject; 23 import org.apache.ws.jaxme.xs.xml.XsTSimpleType; 24 import org.apache.ws.jaxme.xs.xml.impl.XsEAppinfoImpl; 25 import org.xml.sax.ContentHandler ; 26 import org.xml.sax.SAXException ; 27 28 29 32 public class JAXBAppinfoImpl extends XsEAppinfoImpl { 33 35 public JAXBAppinfoImpl(XsObject pParent) { 36 super(pParent); 37 } 38 39 protected JAXBXsObjectFactory getJAXBXsObjectFactory() { return (JAXBXsObjectFactory) getObjectFactory(); } 40 41 43 public JAXBClass createClass() { 44 JAXBClass jaxbClass = getJAXBXsObjectFactory().newJAXBClass(this); 45 addChild(jaxbClass); 46 return jaxbClass; 47 } 48 49 51 public JAXBGlobalBindings createGlobalBindings() { 52 JAXBGlobalBindings jaxbGlobalBindings = getJAXBXsObjectFactory().newJAXBGlobalBindings(this); 53 addChild(jaxbGlobalBindings); 54 return jaxbGlobalBindings; 55 } 56 57 59 public JAXBJavadoc createJavadoc() { 60 JAXBJavadoc jaxbJavadoc = getJAXBXsObjectFactory().newJAXBJavadoc(this); 61 addChild(jaxbJavadoc); 62 return jaxbJavadoc; 63 } 64 65 67 public JAXBJavaType createJavaType() { 68 JAXBJavaType jaxbJavaType = getJAXBXsObjectFactory().newJAXBJavaType(this); 69 addChild(jaxbJavaType); 70 return jaxbJavaType; 71 } 72 73 75 public JAXBProperty createProperty() { 76 JAXBProperty jaxbProperty = getJAXBXsObjectFactory().newJAXBProperty(this); 77 addChild(jaxbProperty); 78 return jaxbProperty; 79 } 80 81 83 public JAXBSchemaBindings createSchemaBindings() { 84 JAXBSchemaBindings jaxbSchemaBindings = getJAXBXsObjectFactory().newJAXBSchemaBindings(this); 85 addChild(jaxbSchemaBindings); 86 return jaxbSchemaBindings; 87 } 88 89 91 public JAXBTypesafeEnumClass createTypesafeEnumClass() throws SAXException { 92 XsObject annotationParent = getParentObject(); 93 if (annotationParent instanceof XsEAnnotation) { 94 XsObject simpleTypeParent = annotationParent.getParentObject(); 95 if (simpleTypeParent instanceof XsTSimpleType) { 96 JAXBTypesafeEnumClass jaxbTypesafeEnumClass = getJAXBXsObjectFactory().newJAXBTypesafeEnumClass(this); 97 addChild(jaxbTypesafeEnumClass); 98 return jaxbTypesafeEnumClass; 99 } 100 } 101 System.err.println("this = " + this); 102 System.err.println("AnnotationParent = " + annotationParent); 103 System.err.println("annotationParent.parent = " + annotationParent.getParentObject()); 104 throw new LocSAXException("The declaration of a typesafeEnumClass is only allowed in xs:simpleType/xs:annotation/xs:appinfo.", getLocator()); 105 } 106 107 109 public JAXBTypesafeEnumMember createTypesafeEnumMember() { 110 JAXBTypesafeEnumMember jaxbTypesafeEnumMember = getJAXBXsObjectFactory().newJAXBTypesafeEnumMember(this); 111 addChild(jaxbTypesafeEnumMember); 112 return jaxbTypesafeEnumMember; 113 } 114 115 public ContentHandler getChildHandler(String pQName, String pNamespaceURI, String pLocalName) throws SAXException { 116 if (JAXBParser.JAXB_SCHEMA_URI.equals(pNamespaceURI)) { 117 return null; 118 } else { 119 return super.getChildHandler(pQName, pNamespaceURI, pLocalName); 120 } 121 } 122 } 123 | Popular Tags |