KickJava   Java API By Example, From Geeks To Geeks.

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


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
21
22 /** <p>Implementation of the <code>xs:realGroup</code> type, as specified
23  * by the following:
24  * <pre>
25  * &lt;xs:complexType name="realGroup"&gt;
26  * &lt;xs:complexContent&gt;
27  * &lt;xs:restriction base="xs:group"&gt;
28  * &lt;xs:sequence&gt;
29  * &lt;xs:element ref="xs:annotation" minOccurs="0"/&gt;
30  * &lt;xs:choice minOccurs="0" maxOccurs="1"&gt;
31  * &lt;xs:element ref="xs:all"/&gt;
32  * &lt;xs:element ref="xs:choice"/&gt;
33  * &lt;xs:element ref="xs:sequence"/&gt;
34  * &lt;/xs:choice&gt;
35  * &lt;/xs:sequence&gt;
36  * &lt;/xs:restriction&gt;
37  * &lt;/xs:complexContent&gt;
38  * &lt;/xs:complexType&gt;
39  * </pre></p>
40  * <p><em>Implementation note:</em> This interface does not define
41  * any additional methods. However, the <code>validate()</code>
42  * method must ensure, that either of <code>xs:all</code>,
43  * <code>xs:choice</code>, or <code>xs:sequence</code> is set.</p>
44  *
45  * @author <a HREF="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
46  */

47 public class XsTRealGroupImpl extends XsTGroupImpl implements XsTRealGroup {
48   protected XsTRealGroupImpl(XsObject pParent) {
49     super(pParent);
50   }
51
52   public XsTGroupRef createGroup() {
53     throw new IllegalStateException JavaDoc("This group must not reference other groups.");
54   }
55
56   public XsEAny createAny() {
57     throw new IllegalStateException JavaDoc("This group must not have an an 'any' element.");
58   }
59
60   public XsTLocalElement createElement() {
61     throw new IllegalStateException JavaDoc("This group must not have an 'element' child element.");
62   }
63
64   public XsESequence createSequence() {
65     return super.createSequence();
66   }
67
68   public XsEChoice createChoice() {
69     return super.createChoice();
70   }
71
72   public XsTAll createAll() {
73     return super.createAll();
74   }
75
76   public void validate() {
77     if (getParticles().length > 1) {
78       throw new IllegalStateException JavaDoc("This group must have exactly a single 'sequence', 'choice', or 'all' element.");
79     }
80   }
81 }
82
Popular Tags