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 the Simple Type Definition schema component. This
25   * interface provides several query operations for facet components. Users
26   * can either retrieve the defined facets as XML Schema components, using
27   * the <code>facets</code> and the <code>multiValueFacets</code> attributes;
28   * or users can separately query a facet's properties using methods such as
29   * <code>getLexicalFacetValue</code>, <code>isFixedFacet</code>, etc.
30   */
31  public interface XSSimpleTypeDefinition extends XSTypeDefinition {
32      // Variety definitions
33      /**
34       * The variety is absent for the anySimpleType definition.
35       */
36      public static final short VARIETY_ABSENT            = 0;
37      /**
38       * <code>Atomic</code> type.
39       */
40      public static final short VARIETY_ATOMIC            = 1;
41      /**
42       * <code>List</code> type.
43       */
44      public static final short VARIETY_LIST              = 2;
45      /**
46       * <code>Union</code> type.
47       */
48      public static final short VARIETY_UNION             = 3;
49  
50      // Facets
51      /**
52       * No facets defined.
53       */
54      public static final short FACET_NONE                = 0;
55      /**
56       * 4.3.1 Length
57       */
58      public static final short FACET_LENGTH              = 1;
59      /**
60       * 4.3.2 minLength.
61       */
62      public static final short FACET_MINLENGTH           = 2;
63      /**
64       * 4.3.3 maxLength.
65       */
66      public static final short FACET_MAXLENGTH           = 4;
67      /**
68       * 4.3.4 pattern.
69       */
70      public static final short FACET_PATTERN             = 8;
71      /**
72       * 4.3.5 whitespace.
73       */
74      public static final short FACET_WHITESPACE          = 16;
75      /**
76       * 4.3.7 maxInclusive.
77       */
78      public static final short FACET_MAXINCLUSIVE        = 32;
79      /**
80       * 4.3.9 maxExclusive.
81       */
82      public static final short FACET_MAXEXCLUSIVE        = 64;
83      /**
84       * 4.3.9 minExclusive.
85       */
86      public static final short FACET_MINEXCLUSIVE        = 128;
87      /**
88       * 4.3.10 minInclusive.
89       */
90      public static final short FACET_MININCLUSIVE        = 256;
91      /**
92       * 4.3.11 totalDigits .
93       */
94      public static final short FACET_TOTALDIGITS         = 512;
95      /**
96       * 4.3.12 fractionDigits.
97       */
98      public static final short FACET_FRACTIONDIGITS      = 1024;
99      /**
100      * 4.3.5 enumeration.
101      */
102     public static final short FACET_ENUMERATION         = 2048;
103 
104     /**
105      * A constant defined for the 'ordered' fundamental facet: not ordered.
106      */
107     public static final short ORDERED_FALSE             = 0;
108     /**
109      * A constant defined for the 'ordered' fundamental facet: partially
110      * ordered.
111      */
112     public static final short ORDERED_PARTIAL           = 1;
113     /**
114      * A constant defined for the 'ordered' fundamental facet: total ordered.
115      */
116     public static final short ORDERED_TOTAL             = 2;
117     /**
118      * [variety]: one of {atomic, list, union} or absent.
119      */
120     public short getVariety();
121 
122     /**
123      * If variety is <code>atomic</code> the primitive type definition (a
124      * built-in primitive datatype definition or the simple ur-type
125      * definition) is available, otherwise <code>null</code>.
126      */
127     public XSSimpleTypeDefinition getPrimitiveType();
128 
129     /**
130      * Returns the closest built-in type category this type represents or
131      * derived from. For example, if this simple type is a built-in derived
132      * type integer the <code>INTEGER_DV</code> is returned.
133      */
134     public short getBuiltInKind();
135 
136     /**
137      * If variety is <code>list</code> the item type definition (an atomic or
138      * union simple type definition) is available, otherwise
139      * <code>null</code>.
140      */
141     public XSSimpleTypeDefinition getItemType();
142 
143     /**
144      * If variety is <code>union</code> the list of member type definitions (a
145      * non-empty sequence of simple type definitions) is available,
146      * otherwise an empty <code>XSObjectList</code>.
147      */
148     public XSObjectList getMemberTypes();
149 
150     /**
151      * [facets]: all facets defined on this type. The value is a bit
152      * combination of FACET_XXX constants of all defined facets.
153      */
154     public short getDefinedFacets();
155 
156     /**
157      * Convenience method. [Facets]: check whether a facet is defined on this
158      * type.
159      * @param facetName  The name of the facet.
160      * @return  True if the facet is defined, false otherwise.
161      */
162     public boolean isDefinedFacet(short facetName);
163 
164     /**
165      * [facets]: all defined facets for this type which are fixed.
166      */
167     public short getFixedFacets();
168 
169     /**
170      * Convenience method. [Facets]: check whether a facet is defined and
171      * fixed on this type.
172      * @param facetName  The name of the facet.
173      * @return  True if the facet is fixed, false otherwise.
174      */
175     public boolean isFixedFacet(short facetName);
176 
177     /**
178      * Convenience method. Returns a value of a single constraining facet for
179      * this simple type definition. This method must not be used to retrieve
180      * values for <code>enumeration</code> and <code>pattern</code> facets.
181      * @param facetName The name of the facet, i.e.
182      *   <code>FACET_LENGTH, FACET_TOTALDIGITS</code>.
183      *   To retrieve the value for a pattern or
184      *   an enumeration, see <code>enumeration</code> and
185      *   <code>pattern</code>.
186      * @return A value of the facet specified in <code>facetName</code> for
187      *   this simple type definition or <code>null</code>.
188      */
189     public String getLexicalFacetValue(short facetName);
190 
191     /**
192      * A list of enumeration values if it exists, otherwise an empty
193      * <code>StringList</code>.
194      */
195     public StringList getLexicalEnumeration();
196 
197     /**
198      * A list of pattern values if it exists, otherwise an empty
199      * <code>StringList</code>.
200      */
201     public StringList getLexicalPattern();
202 
203     /**
204      *  Fundamental Facet: ordered.
205      */
206     public short getOrdered();
207 
208     /**
209      * Fundamental Facet: cardinality.
210      */
211     public boolean getFinite();
212 
213     /**
214      * Fundamental Facet: bounded.
215      */
216     public boolean getBounded();
217 
218     /**
219      * Fundamental Facet: numeric.
220      */
221     public boolean getNumeric();
222 
223     /**
224      *  A list of constraining facets if it exists, otherwise an empty
225      * <code>XSObjectList</code>. Note: This method must not be used to
226      * retrieve values for <code>enumeration</code> and <code>pattern</code>
227      * facets.
228      */
229     public XSObjectList getFacets();
230 
231     /**
232      *  A list of enumeration and pattern constraining facets if it exists,
233      * otherwise an empty <code>XSObjectList</code>.
234      */
235     public XSObjectList getMultiValueFacets();
236 
237     /**
238      * A sequence of [annotations] or an empty <code>XSObjectList</code>.
239      */
240     public XSObjectList getAnnotations();
241 
242 }