View Javadoc
1   /*
2    * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
3    * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4    *
5    * This code is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU General Public License version 2 only, as
7    * published by the Free Software Foundation.  Oracle designates this
8    * particular file as subject to the "Classpath" exception as provided
9    * by Oracle in the LICENSE file that accompanied this code.
10   *
11   * This code is distributed in the hope that it will be useful, but WITHOUT
12   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13   * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14   * version 2 for more details (a copy is included in the LICENSE file that
15   * accompanied this code).
16   *
17   * You should have received a copy of the GNU General Public License version
18   * 2 along with this work; if not, write to the Free Software Foundation,
19   * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20   *
21   * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22   * or visit www.oracle.com if you need additional information or have any
23   * questions.
24   */
25  
26  package com.sun.xml.internal.xsom;
27  
28  import java.util.List;
29  
30  
31  /**
32   * Complex type.
33   *
34   * @author
35   *  Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
36   */
37  public interface XSComplexType extends XSType, XSAttContainer
38  {
39      /**
40       * Checks if this complex type is declared as an abstract type.
41       */
42      boolean isAbstract();
43  
44      boolean isFinal(int derivationMethod);
45      /**
46       * Roughly corresponds to the block attribute. But see the spec
47       * for gory detail.
48       */
49      boolean isSubstitutionProhibited(int method);
50  
51      /**
52       * Gets the scope of this complex type.
53       * This is not a property defined in the schema spec.
54       *
55       * @return
56       *      null if this complex type is global. Otherwise
57       *      return the element declaration that contains this anonymous
58       *      complex type.
59       */
60      XSElementDecl getScope();
61  
62      /**
63       * The content of this complex type.
64       *
65       * @return
66       *      always non-null.
67       */
68      XSContentType getContentType();
69  
70      /**
71       * Gets the explicit content of a complex type with a complex content
72       * that was derived by extension.
73       *
74       * <p>
75       * Informally, the "explicit content" is the portion of the
76       * content model added in this derivation. IOW, it's a delta between
77       * the base complex type and this complex type.
78       *
79       * <p>
80       * For example, when a complex type T2 derives fom T1, then:
81       * <pre>
82       * content type of T2 = SEQUENCE( content type of T1, explicit content of T2 )
83       * </pre>
84       *
85       * @return
86       *      If this complex type is derived by restriction or has a
87       *      simple content, this method returns null.
88       *      IOW, this method only works for a complex type with
89       *      a complex content derived by extension from another complex type.
90       */
91      XSContentType getExplicitContent();
92  
93      // meaningful only if getContentType returns particles
94      boolean isMixed();
95  
96      /**
97       * If this {@link XSComplexType} is redefined by another complex type,
98       * return that component.
99       *
100      * @return null
101      *      if this component has not been redefined.
102      */
103     public XSComplexType getRedefinedBy();
104 
105     /**
106      * Returns a list of direct subtypes of this complex type. If the type is not subtyped, returns empty list.
107      * Doesn't return null.
108      * Note that the complex type may be extended outside of the scope of the schemaset known to XSOM.
109      * @return
110      */
111     public List<XSComplexType> getSubtypes();
112 
113     /**
114      * Returns a list of element declarations of this type.
115      * @return
116      */
117     public List<XSElementDecl> getElementDecls();
118 
119 }