KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ws > jaxme > xs > jaxb > impl > JAXBAppinfoImpl


1 /*
2  * Copyright 2003, 2004 The Apache Software Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15
16  */

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 JavaDoc;
26 import org.xml.sax.SAXException JavaDoc;
27
28
29 /**
30  * @author <a HREF="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
31  */

32 public class JAXBAppinfoImpl extends XsEAppinfoImpl {
33   /** <p>Creates a new instance of JAXBAppinfo.</p>
34    */

35   public JAXBAppinfoImpl(XsObject pParent) {
36     super(pParent);
37   }
38
39   protected JAXBXsObjectFactory getJAXBXsObjectFactory() { return (JAXBXsObjectFactory) getObjectFactory(); }
40
41   /** <p>Creates a new instance of {@link JAXBClass}.</p>
42    */

43   public JAXBClass createClass() {
44     JAXBClass jaxbClass = getJAXBXsObjectFactory().newJAXBClass(this);
45     addChild(jaxbClass);
46     return jaxbClass;
47   }
48
49   /** <p>Creates a new instance of {@link JAXBGlobalBindings}.</p>
50    */

51   public JAXBGlobalBindings createGlobalBindings() {
52     JAXBGlobalBindings jaxbGlobalBindings = getJAXBXsObjectFactory().newJAXBGlobalBindings(this);
53     addChild(jaxbGlobalBindings);
54     return jaxbGlobalBindings;
55   }
56
57   /** <p>Creates a new instance of {@link JAXBJavadoc}.</p>
58    */

59   public JAXBJavadoc createJavadoc() {
60     JAXBJavadoc jaxbJavadoc = getJAXBXsObjectFactory().newJAXBJavadoc(this);
61     addChild(jaxbJavadoc);
62     return jaxbJavadoc;
63   }
64
65   /** <p>Creates a new instance of {@link JAXBJavaType}.</p>
66    */

67   public JAXBJavaType createJavaType() {
68     JAXBJavaType jaxbJavaType = getJAXBXsObjectFactory().newJAXBJavaType(this);
69     addChild(jaxbJavaType);
70     return jaxbJavaType;
71   }
72
73   /** <p>Creates a new instance of {@link JAXBProperty}.</p>
74    */

75   public JAXBProperty createProperty() {
76     JAXBProperty jaxbProperty = getJAXBXsObjectFactory().newJAXBProperty(this);
77     addChild(jaxbProperty);
78     return jaxbProperty;
79   }
80
81   /** <p>Creates a new instance of {@link JAXBSchemaBindings}.</p>
82    */

83   public JAXBSchemaBindings createSchemaBindings() {
84     JAXBSchemaBindings jaxbSchemaBindings = getJAXBXsObjectFactory().newJAXBSchemaBindings(this);
85     addChild(jaxbSchemaBindings);
86     return jaxbSchemaBindings;
87   }
88
89   /** <p>Creates a new instance of {@link JAXBTypesafeEnumClass}.</p>
90    */

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   /** <p>Creates a new instance of {@link JAXBTypesafeEnumMember}.</p>
108    */

109   public JAXBTypesafeEnumMember createTypesafeEnumMember() {
110     JAXBTypesafeEnumMember jaxbTypesafeEnumMember = getJAXBXsObjectFactory().newJAXBTypesafeEnumMember(this);
111     addChild(jaxbTypesafeEnumMember);
112     return jaxbTypesafeEnumMember;
113   }
114
115   public ContentHandler JavaDoc getChildHandler(String JavaDoc pQName, String JavaDoc pNamespaceURI, String JavaDoc 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