KickJava   Java API By Example, From Geeks To Geeks.

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


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 following type:
24  * <pre>
25  * &lt;xs:complexType name="all"&gt;
26  * &lt;xs:annotation&gt;
27  * &lt;xs:documentation&gt;
28  * Only elements allowed inside
29  * &lt;/xs:documentation&gt;
30  * &lt;/xs:annotation&gt;
31  * &lt;xs:complexContent&gt;
32  * &lt;xs:restriction base="xs:explicitGroup"&gt;
33  * &lt;xs:group ref="xs:allModel"/&gt;
34  * &lt;xs:attribute name="minOccurs" use="optional" default="1"&gt;
35  * &lt;xs:simpleType&gt;
36  * &lt;xs:restriction base="xs:nonNegativeInteger"&gt;
37  * &lt;xs:enumeration value="0"/&gt;
38  * &lt;xs:enumeration value="1"/&gt;
39  * &lt;/xs:restriction&gt;
40  * &lt;/xs:simpleType&gt;
41  * &lt;/xs:attribute&gt;
42  * &lt;xs:attribute name="maxOccurs" use="optional" default="1"&gt;
43  * &lt;xs:simpleType&gt;
44  * &lt;xs:restriction base="xs:allNNI"&gt;
45  * &lt;xs:enumeration value="1"/&gt;
46  * &lt;/xs:restriction&gt;
47  * &lt;/xs:simpleType&gt;
48  * &lt;/xs:attribute&gt;
49  * &lt;/xs:restriction&gt;
50  * &lt;/xs:complexContent&gt;
51  * &lt;/xs:complexType&gt;
52  * </pre></p>
53  *
54  * @author <a HREF="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
55  */

56 public class XsTAllImpl extends XsTAnnotatedImpl implements XsTAll {
57   private final XsAGOccurs occurs;
58   private final XsGParticle particle;
59
60   protected XsTAllImpl(XsObject pParent) {
61     super(pParent);
62     occurs = getObjectFactory().newXsAGOccurs(this);
63     particle = getObjectFactory().newXsGParticle(this);
64   }
65
66   public void setName(XsNCName pName) {
67     throw new IllegalStateException JavaDoc("Use of the 'name' attribute is prohibited in xs:explicitGroup");
68   }
69
70   public XsNCName getName() {
71     throw new IllegalStateException JavaDoc("Use of the 'name' attribute is prohibited in xs:explicitGroup");
72   }
73
74   public void setRef(XsQName pRef) {
75     throw new IllegalStateException JavaDoc("Use of the 'name' attribute is prohibited in xs:explicitGroup");
76   }
77
78   public void setRef(String JavaDoc pRef) throws SAXException JavaDoc {
79     throw new IllegalStateException JavaDoc("Use of the 'name' attribute is prohibited in xs:explicitGroup");
80   }
81
82   public XsQName getRef() {
83     throw new IllegalStateException JavaDoc("Use of the 'name' attribute is prohibited in xs:explicitGroup");
84   }
85
86   public void setMaxOccurs(String JavaDoc pMaxOccurs) {
87     try {
88       if (Integer.parseInt(pMaxOccurs) != 1) {
89         throw new IllegalArgumentException JavaDoc();
90       }
91     } catch (Exception JavaDoc e) {
92       throw new IllegalArgumentException JavaDoc("Invalid value of the 'maxOccurs' attribute: " + pMaxOccurs + "; must be 1");
93     }
94   }
95
96   public int getMaxOccurs() {
97     return 1;
98   }
99
100   public void setMinOccurs(int pMinOccurs) {
101     occurs.setMinOccurs(pMinOccurs);
102   }
103
104   public int getMinOccurs() {
105     return occurs.getMinOccurs();
106   }
107
108   public XsTLocalElement createElement() {
109     return particle.createElement();
110   }
111
112   public XsTGroupRef createGroup() {
113     return particle.createGroup();
114   }
115
116   public XsTAll createAll() {
117     return particle.createAll();
118   }
119
120   public XsESequence createSequence() {
121     return particle.createSequence();
122   }
123
124   public XsEChoice createChoice() {
125     return particle.createChoice();
126   }
127
128   public XsEAny createAny() {
129     return particle.createAny();
130   }
131
132   public XsTParticle[] getParticles() {
133     return particle.getParticles();
134   }
135
136   public void validate() throws SAXException JavaDoc {
137     super.validate();
138   }
139 }
140
Popular Tags