KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ws > jaxme > xs > xml > impl > XsTExtensionTypeImpl


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.xml.impl;
18
19 import org.apache.ws.jaxme.xs.xml.*;
20 import org.xml.sax.SAXException JavaDoc;
21
22
23 /** <p>Implementation of the <code>xs:extensionType</code> type, as
24  * specified by:
25  * <pre>
26  * &lt;xs:complexType name="extensionType"&gt;
27  * &lt;xs:complexContent&gt;
28  * &lt;xs:extension base="xs:annotated"&gt;
29  * &lt;xs:sequence&gt;
30  * &lt;xs:group ref="xs:typeDefParticle" minOccurs="0"/&gt;
31  * &lt;xs:group ref="xs:attrDecls"/&gt;
32  * &lt;/xs:sequence&gt;
33  * &lt;xs:attribute name="base" type="xs:QName" use="required"/&gt;
34  * &lt;/xs:extension&gt;
35  * &lt;/xs:complexContent&gt;
36  * &lt;/xs:complexType&gt;
37  * </pre></p>
38  *
39  * @author <a HREF="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
40  */

41 public class XsTExtensionTypeImpl extends XsTAnnotatedImpl implements XsTExtensionType {
42   private XsQName base;
43   private final XsGTypeDefParticle particle;
44   private final XsGAttrDecls attrDecls;
45
46   protected XsTExtensionTypeImpl(XsObject pParent) {
47     super(pParent);
48     particle = getObjectFactory().newXsGTypeDefParticle(this);
49     attrDecls = getObjectFactory().newXsGAttrDecls(this);
50   }
51
52   public void setBase(XsQName pBase) {
53     base = pBase;
54   }
55
56   public void setBase(String JavaDoc pBase) throws SAXException JavaDoc {
57     setBase(asXsQName(pBase));
58   }
59
60   public XsQName getBase() {
61     return base;
62   }
63
64   public XsTGroupRef createGroup() {
65     return particle.createGroup();
66   }
67
68   public XsTAll createAll() {
69     return particle.createAll();
70   }
71
72   public XsEChoice createChoice() {
73     return particle.createChoice();
74   }
75
76   public XsESequence createSequence() {
77     return particle.createSequence();
78   }
79
80   public XsTTypeDefParticle getTypeDefParticle() {
81     return particle.getTypeDefParticle();
82   }
83
84   public XsTAttribute createAttribute() {
85     return attrDecls.createAttribute();
86   }
87
88   public XsTAttribute[] getAttributes() {
89     return attrDecls.getAttributes();
90   }
91
92   public XsTAttributeGroupRef createAttributeGroup() {
93     return attrDecls.createAttributeGroup();
94   }
95
96   public XsTAttributeGroupRef[] getAttributeGroups() {
97     return attrDecls.getAttributeGroups();
98   }
99
100   public XsTWildcard createAnyAttribute() {
101     return attrDecls.createAnyAttribute();
102   }
103
104   public XsTWildcard getAnyAttribute() {
105     return attrDecls.getAnyAttribute();
106   }
107
108   public Object JavaDoc[] getAllAttributes() {
109     return attrDecls.getAllAttributes();
110   }
111
112   public void validate() throws SAXException JavaDoc {
113     super.validate();
114     if (getBase() == null) {
115       throw new NullPointerException JavaDoc("Missing 'base' attribute.");
116     }
117   }
118 }
119
Popular Tags