KickJava   Java API By Example, From Geeks To Geeks.

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


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 java.util.ArrayList JavaDoc;
20 import java.util.List JavaDoc;
21
22 import org.apache.ws.jaxme.xs.xml.*;
23
24
25 /** <p>Implementation of <code>xs:allModel</code>, as specified by
26  * the following:
27  * <pre>
28  * &lt;xs:group name="allModel"&gt;
29  * &lt;xs:sequence&gt;
30  * &lt;xs:element ref="xs:annotation" minOccurs="0"/&gt;
31  * &lt;xs:element name="element" minOccurs="0" maxOccurs="unbounded"&gt;
32  * &lt;xs:complexType&gt;
33  * &lt;xs:annotation&gt;
34  * &lt;xs:documentation&gt;restricted max/min&lt;/xs:documentation&gt;
35  * &lt;/xs:annotation&gt;
36  * &lt;xs:complexContent&gt;
37  * &lt;xs:restriction base="xs:localElement"&gt;
38  * &lt;xs:sequence&gt;
39  * &lt;xs:element ref="xs:annotation" minOccurs="0"/&gt;
40  * &lt;xs:choice minOccurs="0"&gt;
41  * &lt;xs:element name="simpleType" type="xs:localSimpleType"/&gt;
42  * &lt;xs:element name="complexType" type="xs:localComplexType"/&gt;
43  * &lt;/xs:choice&gt;
44  * &lt;xs:group ref="xs:identityConstraint" minOccurs="0"
45  * maxOccurs="unbounded"/&gt;
46  * &lt;/xs:sequence&gt;
47  * &lt;xs:attribute name="minOccurs" use="optional" default="1"&gt;
48  * &lt;xs:simpleType&gt;
49  * &lt;xs:restriction base="xs:nonNegativeInteger"&gt;
50  * &lt;xs:enumeration value="0"/&gt;
51  * &lt;xs:enumeration value="1"/&gt;
52  * &lt;/xs:restriction&gt;
53  * &lt;/xs:simpleType&gt;
54  * &lt;/xs:attribute&gt;
55  * &lt;xs:attribute name="maxOccurs" use="optional" default="1"&gt;
56  * &lt;xs:simpleType&gt;
57  * &lt;xs:restriction base="xs:allNNI"&gt;
58  * &lt;xs:enumeration value="0"/&gt;
59  * &lt;xs:enumeration value="1"/&gt;
60  * &lt;/xs:restriction&gt;
61  * &lt;/xs:simpleType&gt;
62  * &lt;/xs:attribute&gt;
63  * &lt;/xs:restriction&gt;
64  * &lt;/xs:complexContent&gt;
65  * &lt;/xs:complexType&gt;
66  * &lt;/xs:element&gt;
67  * &lt;/xs:sequence&gt;
68  * &lt;/xs:group&gt;
69  * </pre></p>
70  * <p><em>Implementation note: The above restriction of a {@link XsTLocalElement}
71  * is interpreted as a usual local element, except that the <code>minOccurs</code>
72  * and <code>maxOccurs</code> attributes must be 0 or 1.</p>
73  *
74  * @author <a HREF="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
75  */

76 public class XsGAllModelImpl extends XsTAnnotatedImpl implements XsGAllModel {
77   private List JavaDoc elements;
78
79   protected XsGAllModelImpl(XsObject pParent) {
80     super(pParent);
81   }
82
83   public XsTLocalElement createElement() {
84     XsTLocalElement element = getObjectFactory().newXsTLocalAllElement(this);
85     if (elements == null) {
86       elements = new ArrayList JavaDoc();
87     }
88     elements.add(element);
89     return element;
90   }
91
92   public XsTLocalElement[] getElements() {
93     if (elements == null) {
94       return new XsTLocalElement[0];
95     }
96     return (XsTLocalElement[]) elements.toArray(new XsTLocalElement[elements.size()]);
97   }
98 }
99
Popular Tags