Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

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   *  &lt;xs:element name="complexContent" id="complexContent"&gt;
26   *    &lt;xs:annotation&gt;
27   *      &lt;xs:documentation
28   *          source="http://www.w3.org/TR/xmlschema-1/#element-complexContent"/&gt;
29   *    &lt;/xs:annotation&gt;
30   *    &lt;xs:complexType&gt;
31   *      &lt;xs:complexContent&gt;
32   *        &lt;xs:extension base="xs:annotated"&gt;
33   *          &lt;xs:choice&gt;
34   *            &lt;xs:element name="restriction" type="xs:complexRestrictionType"/&gt;
35   *            &lt;xs:element name="extension" type="xs:extensionType"/&gt;
36   *          &lt;/xs:choice&gt;
37   *          &lt;xs:attribute name="mixed" type="xs:boolean"&gt;
38   *            &lt;xs:annotation&gt;
39   *              &lt;xs:documentation&gt;
40   *                Overrides any setting on complexType parent.
41   *              &lt;/xs:documentation&gt;
42   *            &lt;/xs:annotation&gt;
43   *          &lt;/xs:attribute&gt;
44   *        &lt;/xs:extension&gt;
45   *      &lt;/xs:complexContent&gt;
46   *    &lt;/xs:complexType&gt;
47   *  &lt;/xs:element&gt;
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  }