KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > xerces > xs > XSTypeDefinition


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.xerces.xs;
18
19 /**
20  * This interface represents a complex or simple type definition.
21  */

22 public interface XSTypeDefinition extends XSObject {
23     /**
24      * The object describes a complex type.
25      */

26     public static final short COMPLEX_TYPE = 15;
27     /**
28      * The object describes a simple type.
29      */

30     public static final short SIMPLE_TYPE = 16;
31     /**
32      * Return whether this type definition is a simple type or complex type.
33      */

34     public short getTypeCategory();
35
36     /**
37      * {base type definition}: either a simple type definition or a complex
38      * type definition.
39      */

40     public XSTypeDefinition getBaseType();
41
42     /**
43      * {final}. For a complex type definition it is a subset of {extension,
44      * restriction}. For a simple type definition it is a subset of
45      * {extension, list, restriction, union}.
46      * @param restriction Extension, restriction, list, union constants
47      * (defined in <code>XSConstants</code>).
48      * @return True if <code>restriction</code> is in the final set,
49      * otherwise false.
50      */

51     public boolean isFinal(short restriction);
52
53     /**
54      * For complex types the returned value is a bit combination of the subset
55      * of {<code>DERIVATION_EXTENSION, DERIVATION_RESTRICTION</code>}
56      * corresponding to <code>final</code> set of this type or
57      * <code>DERIVATION_NONE</code>. For simple types the returned value is
58      * a bit combination of the subset of {
59      * <code>DERIVATION_RESTRICTION, DERIVATION_EXTENSION, DERIVATION_UNION, DERIVATION_LIST</code>
60      * } corresponding to <code>final</code> set of this type or
61      * <code>DERIVATION_NONE</code>.
62      */

63     public short getFinal();
64
65     /**
66      * Convenience attribute. A boolean that specifies if the type definition
67      * is anonymous.
68      */

69     public boolean getAnonymous();
70
71     /**
72      * Convenience method which checks if this type is derived from the given
73      * <code>ancestorType</code>.
74      * @param ancestorType An ancestor type definition.
75      * @param derivationMethod A bit combination representing a subset of {
76      * <code>DERIVATION_RESTRICTION, DERIVATION_EXTENSION, DERIVATION_UNION, DERIVATION_LIST</code>
77      * }.
78      * @return True if this type is derived from <code>ancestorType</code>
79      * using only derivation methods from the <code>derivationMethod</code>
80      * .
81      */

82     public boolean derivedFromType(XSTypeDefinition ancestorType,
83                                    short derivationMethod);
84
85     /**
86      * Convenience method which checks if this type is derived from the given
87      * ancestor type.
88      * @param namespace An ancestor type namespace.
89      * @param name An ancestor type name.
90      * @param derivationMethod A bit combination representing a subset of {
91      * <code>DERIVATION_RESTRICTION, DERIVATION_EXTENSION, DERIVATION_UNION, DERIVATION_LIST</code>
92      * }.
93      * @return True if this type is derived from <code>ancestorType</code>
94      * using only derivation methods from the <code>derivationMethod</code>
95      * .
96      */

97     public boolean derivedFrom(String JavaDoc namespace,
98                                String JavaDoc name,
99                                short derivationMethod);
100
101 }
102
Popular Tags