View Javadoc
1   /*
2    * reserved comment block
3    * DO NOT REMOVE OR ALTER!
4    */
5   /*
6    * Copyright 2003,2004 The Apache Software Foundation.
7    *
8    * Licensed under the Apache License, Version 2.0 (the "License");
9    * you may not use this file except in compliance with the License.
10   * You may obtain a copy of the License at
11   *
12   *      http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing, software
15   * distributed under the License is distributed on an "AS IS" BASIS,
16   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17   * See the License for the specific language governing permissions and
18   * limitations under the License.
19   */
20  
21  package com.sun.org.apache.xerces.internal.xs;
22  
23  /**
24   * This interface represents a complex or simple type definition.
25   */
26  public interface XSTypeDefinition extends XSObject {
27      /**
28       * The object describes a complex type.
29       */
30      public static final short COMPLEX_TYPE              = 15;
31      /**
32       * The object describes a simple type.
33       */
34      public static final short SIMPLE_TYPE               = 16;
35      /**
36       * Return whether this type definition is a simple type or complex type.
37       */
38      public short getTypeCategory();
39  
40      /**
41       * {base type definition}: either a simple type definition or a complex
42       * type definition.
43       */
44      public XSTypeDefinition getBaseType();
45  
46      /**
47       * {final}. For a complex type definition it is a subset of {extension,
48       * restriction}. For a simple type definition it is a subset of
49       * {extension, list, restriction, union}.
50       * @param restriction  Extension, restriction, list, union constants
51       *   (defined in <code>XSConstants</code>).
52       * @return True if <code>restriction</code> is in the final set,
53       *   otherwise false.
54       */
55      public boolean isFinal(short restriction);
56  
57      /**
58       * For complex types the returned value is a bit combination of the subset
59       * of {<code>DERIVATION_EXTENSION, DERIVATION_RESTRICTION</code>}
60       * corresponding to <code>final</code> set of this type or
61       * <code>DERIVATION_NONE</code>. For simple types the returned value is
62       * a bit combination of the subset of {
63       * <code>DERIVATION_RESTRICTION, DERIVATION_EXTENSION, DERIVATION_UNION, DERIVATION_LIST</code>
64       * } corresponding to <code>final</code> set of this type or
65       * <code>DERIVATION_NONE</code>.
66       */
67      public short getFinal();
68  
69      /**
70       *  Convenience attribute. A boolean that specifies if the type definition
71       * is anonymous.
72       */
73      public boolean getAnonymous();
74  
75      /**
76       * Convenience method which checks if this type is derived from the given
77       * <code>ancestorType</code>.
78       * @param ancestorType  An ancestor type definition.
79       * @param derivationMethod  A bit combination representing a subset of {
80       *   <code>DERIVATION_RESTRICTION, DERIVATION_EXTENSION, DERIVATION_UNION, DERIVATION_LIST</code>
81       *   }.
82       * @return  True if this type is derived from <code>ancestorType</code>
83       *   using only derivation methods from the <code>derivationMethod</code>
84       *   .
85       */
86      public boolean derivedFromType(XSTypeDefinition ancestorType,
87                                     short derivationMethod);
88  
89      /**
90       * Convenience method which checks if this type is derived from the given
91       * ancestor type.
92       * @param namespace  An ancestor type namespace.
93       * @param name  An ancestor type name.
94       * @param derivationMethod  A bit combination representing a subset of {
95       *   <code>DERIVATION_RESTRICTION, DERIVATION_EXTENSION, DERIVATION_UNION, DERIVATION_LIST</code>
96       *   }.
97       * @return  True if this type is derived from <code>ancestorType</code>
98       *   using only derivation methods from the <code>derivationMethod</code>
99       *   .
100      */
101     public boolean derivedFrom(String namespace,
102                                String name,
103                                short derivationMethod);
104 
105 }