Source code: org/apache/ws/jaxme/xs/xml/impl/XsEComplexContentImpl.java
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 element <code>xs:complexContent</code>,
23 * as specified by:
24 * <pre>
25 * <xs:element name="complexContent" id="complexContent">
26 * <xs:annotation>
27 * <xs:documentation
28 * source="http://www.w3.org/TR/xmlschema-1/#element-complexContent"/>
29 * </xs:annotation>
30 * <xs:complexType>
31 * <xs:complexContent>
32 * <xs:extension base="xs:annotated">
33 * <xs:choice>
34 * <xs:element name="restriction" type="xs:complexRestrictionType"/>
35 * <xs:element name="extension" type="xs:extensionType"/>
36 * </xs:choice>
37 * <xs:attribute name="mixed" type="xs:boolean">
38 * <xs:annotation>
39 * <xs:documentation>
40 * Overrides any setting on complexType parent.
41 * </xs:documentation>
42 * </xs:annotation>
43 * </xs:attribute>
44 * </xs:extension>
45 * </xs:complexContent>
46 * </xs:complexType>
47 * </xs:element>
48 * </pre></p>
49 * @author <a href="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
50 */
51 public class XsEComplexContentImpl extends XsTAnnotatedImpl implements XsEComplexContent {
52 private XsTComplexRestrictionType restriction;
53 private XsTExtensionType extension;
54 private Boolean isMixed;
55
56 protected XsEComplexContentImpl(XsObject pParent) {
57 super(pParent);
58 }
59
60 public XsTComplexRestrictionType createRestriction() {
61 if (restriction != null) {
62 throw new IllegalStateException("Multiple 'restriction' child elements are forbidden.");
63 }
64 if (extension != null) {
65 throw new IllegalStateException("The 'extension' and 'restriction' child elements are mutually exclusive.");
66 }
67 return restriction = getObjectFactory().newXsTComplexRestrictionType(this);
68 }
69
70 public XsTComplexRestrictionType getRestriction() {
71 return restriction;
72 }
73
74 public XsTExtensionType createExtension() {
75 if (extension != null) {
76 throw new IllegalStateException("Multiple 'extension' child elements are forbidden.");
77 }
78 if (restriction != null) {
79 throw new IllegalStateException("The 'extension' and 'restriction' child elements are mutually exclusive.");
80 }
81 return extension = getObjectFactory().newXsTExtensionType(this);
82 }
83
84 public XsTExtensionType getExtension() {
85 return extension;
86 }
87
88 public void setMixed(boolean pMixed) {
89 isMixed = pMixed ? Boolean.TRUE : Boolean.FALSE;
90 }
91
92 public Boolean isMixed() { return isMixed; }
93 }