KickJava   Java API By Example, From Geeks To Geeks.

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


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 the Simple Type Definition schema component. This
21  * interface provides several query operations for facet components. Users
22  * can either retrieve the defined facets as XML Schema components, using
23  * the <code>facets</code> and the <code>multiValueFacets</code> attributes;
24  * or users can separately query a facet's properties using methods such as
25  * <code>getLexicalFacetValue</code>, <code>isFixedFacet</code>, etc.
26  */

27 public interface XSSimpleTypeDefinition extends XSTypeDefinition {
28     // Variety definitions
29
/**
30      * The variety is absent for the anySimpleType definition.
31      */

32     public static final short VARIETY_ABSENT = 0;
33     /**
34      * <code>Atomic</code> type.
35      */

36     public static final short VARIETY_ATOMIC = 1;
37     /**
38      * <code>List</code> type.
39      */

40     public static final short VARIETY_LIST = 2;
41     /**
42      * <code>Union</code> type.
43      */

44     public static final short VARIETY_UNION = 3;
45
46     // Facets
47
/**
48      * No facets defined.
49      */

50     public static final short FACET_NONE = 0;
51     /**
52      * 4.3.1 Length
53      */

54     public static final short FACET_LENGTH = 1;
55     /**
56      * 4.3.2 minLength.
57      */

58     public static final short FACET_MINLENGTH = 2;
59     /**
60      * 4.3.3 maxLength.
61      */

62     public static final short FACET_MAXLENGTH = 4;
63     /**
64      * 4.3.4 pattern.
65      */

66     public static final short FACET_PATTERN = 8;
67     /**
68      * 4.3.5 whitespace.
69      */

70     public static final short FACET_WHITESPACE = 16;
71     /**
72      * 4.3.7 maxInclusive.
73      */

74     public static final short FACET_MAXINCLUSIVE = 32;
75     /**
76      * 4.3.9 maxExclusive.
77      */

78     public static final short FACET_MAXEXCLUSIVE = 64;
79     /**
80      * 4.3.9 minExclusive.
81      */

82     public static final short FACET_MINEXCLUSIVE = 128;
83     /**
84      * 4.3.10 minInclusive.
85      */

86     public static final short FACET_MININCLUSIVE = 256;
87     /**
88      * 4.3.11 totalDigits .
89      */

90     public static final short FACET_TOTALDIGITS = 512;
91     /**
92      * 4.3.12 fractionDigits.
93      */

94     public static final short FACET_FRACTIONDIGITS = 1024;
95     /**
96      * 4.3.5 enumeration.
97      */

98     public static final short FACET_ENUMERATION = 2048;
99
100     /**
101      * A constant defined for the 'ordered' fundamental facet: not ordered.
102      */

103     public static final short ORDERED_FALSE = 0;
104     /**
105      * A constant defined for the 'ordered' fundamental facet: partially
106      * ordered.
107      */

108     public static final short ORDERED_PARTIAL = 1;
109     /**
110      * A constant defined for the 'ordered' fundamental facet: total ordered.
111      */

112     public static final short ORDERED_TOTAL = 2;
113     /**
114      * [variety]: one of {atomic, list, union} or absent.
115      */

116     public short getVariety();
117
118     /**
119      * If variety is <code>atomic</code> the primitive type definition (a
120      * built-in primitive datatype definition or the simple ur-type
121      * definition) is available, otherwise <code>null</code>.
122      */

123     public XSSimpleTypeDefinition getPrimitiveType();
124
125     /**
126      * Returns the closest built-in type category this type represents or
127      * derived from. For example, if this simple type is a built-in derived
128      * type integer the <code>INTEGER_DV</code> is returned.
129      */

130     public short getBuiltInKind();
131
132     /**
133      * If variety is <code>list</code> the item type definition (an atomic or
134      * union simple type definition) is available, otherwise
135      * <code>null</code>.
136      */

137     public XSSimpleTypeDefinition getItemType();
138
139     /**
140      * If variety is <code>union</code> the list of member type definitions (a
141      * non-empty sequence of simple type definitions) is available,
142      * otherwise an empty <code>XSObjectList</code>.
143      */

144     public XSObjectList getMemberTypes();
145
146     /**
147      * [facets]: all facets defined on this type. The value is a bit
148      * combination of FACET_XXX constants of all defined facets.
149      */

150     public short getDefinedFacets();
151
152     /**
153      * Convenience method. [Facets]: check whether a facet is defined on this
154      * type.
155      * @param facetName The name of the facet.
156      * @return True if the facet is defined, false otherwise.
157      */

158     public boolean isDefinedFacet(short facetName);
159
160     /**
161      * [facets]: all defined facets for this type which are fixed.
162      */

163     public short getFixedFacets();
164
165     /**
166      * Convenience method. [Facets]: check whether a facet is defined and
167      * fixed on this type.
168      * @param facetName The name of the facet.
169      * @return True if the facet is fixed, false otherwise.
170      */

171     public boolean isFixedFacet(short facetName);
172
173     /**
174      * Convenience method. Returns a value of a single constraining facet for
175      * this simple type definition. This method must not be used to retrieve
176      * values for <code>enumeration</code> and <code>pattern</code> facets.
177      * @param facetName The name of the facet, i.e.
178      * <code>FACET_LENGTH, FACET_TOTALDIGITS</code>.
179      * To retrieve the value for a pattern or
180      * an enumeration, see <code>enumeration</code> and
181      * <code>pattern</code>.
182      * @return A value of the facet specified in <code>facetName</code> for
183      * this simple type definition or <code>null</code>.
184      */

185     public String JavaDoc getLexicalFacetValue(short facetName);
186
187     /**
188      * A list of enumeration values if it exists, otherwise an empty
189      * <code>StringList</code>.
190      */

191     public StringList getLexicalEnumeration();
192
193     /**
194      * A list of pattern values if it exists, otherwise an empty
195      * <code>StringList</code>.
196      */

197     public StringList getLexicalPattern();
198
199     /**
200      * Fundamental Facet: ordered.
201      */

202     public short getOrdered();
203
204     /**
205      * Fundamental Facet: cardinality.
206      */

207     public boolean getFinite();
208
209     /**
210      * Fundamental Facet: bounded.
211      */

212     public boolean getBounded();
213
214     /**
215      * Fundamental Facet: numeric.
216      */

217     public boolean getNumeric();
218
219     /**
220      * A list of constraining facets if it exists, otherwise an empty
221      * <code>XSObjectList</code>. Note: This method must not be used to
222      * retrieve values for <code>enumeration</code> and <code>pattern</code>
223      * facets.
224      */

225     public XSObjectList getFacets();
226
227     /**
228      * A list of enumeration and pattern constraining facets if it exists,
229      * otherwise an empty <code>XSObjectList</code>.
230      */

231     public XSObjectList getMultiValueFacets();
232
233     /**
234      * [annotations]: a set of annotations for this simple type component if
235      * it exists, otherwise an empty <code>XSObjectList</code>.
236      */

237     public XSObjectList getAnnotations();
238
239 }
240
Popular Tags