1. /*
  2. * The Apache Software License, Version 1.1
  3. *
  4. *
  5. * Copyright (c) 2003 The Apache Software Foundation. All rights
  6. * reserved.
  7. *
  8. * Redistribution and use in source and binary forms, with or without
  9. * modification, are permitted provided that the following conditions
  10. * are met:
  11. *
  12. * 1. Redistributions of source code must retain the above copyright
  13. * notice, this list of conditions and the following disclaimer.
  14. *
  15. * 2. Redistributions in binary form must reproduce the above copyright
  16. * notice, this list of conditions and the following disclaimer in
  17. * the documentation and/or other materials provided with the
  18. * distribution.
  19. *
  20. * 3. The end-user documentation included with the redistribution,
  21. * if any, must include the following acknowledgment:
  22. * "This product includes software developed by the
  23. * Apache Software Foundation (http://www.apache.org/)."
  24. * Alternately, this acknowledgment may appear in the software itself,
  25. * if and wherever such third-party acknowledgments normally appear.
  26. *
  27. * 4. The names "Xerces" and "Apache Software Foundation" must
  28. * not be used to endorse or promote products derived from this
  29. * software without prior written permission. For written
  30. * permission, please contact apache@apache.org.
  31. *
  32. * 5. Products derived from this software may not be called "Apache",
  33. * nor may "Apache" appear in their name, without prior written
  34. * permission of the Apache Software Foundation.
  35. *
  36. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  37. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  38. * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  39. * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  40. * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  41. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  42. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  43. * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  44. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  45. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  46. * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  47. * SUCH DAMAGE.
  48. * ====================================================================
  49. *
  50. * This software consists of voluntary contributions made by many
  51. * individuals on behalf of the Apache Software Foundation and was
  52. * originally based on software copyright (c) 2003, International
  53. * Business Machines, Inc., http://www.apache.org. For more
  54. * information on the Apache Software Foundation, please see
  55. * <http://www.apache.org/>.
  56. */
  57. package com.sun.org.apache.xerces.internal.xs;
  58. /**
  59. * This interface represents the Simple Type Definition schema component. This
  60. * interface provides several query operations for facet components. Users
  61. * can either retrieve the defined facets as XML Schema components, using
  62. * the <code>facets</code> and the <code>multiValueFacets</code> attributes;
  63. * or users can separately query a facet's properties using methods such as
  64. * <code>getLexicalFacetValue</code>, <code>isFixedFacet</code>, etc.
  65. */
  66. public interface XSSimpleTypeDefinition extends XSTypeDefinition {
  67. // Variety definitions
  68. /**
  69. * The variety is absent for the anySimpleType definition.
  70. */
  71. public static final short VARIETY_ABSENT = 0;
  72. /**
  73. * <code>Atomic</code> type.
  74. */
  75. public static final short VARIETY_ATOMIC = 1;
  76. /**
  77. * <code>List</code> type.
  78. */
  79. public static final short VARIETY_LIST = 2;
  80. /**
  81. * <code>Union</code> type.
  82. */
  83. public static final short VARIETY_UNION = 3;
  84. // Facets
  85. /**
  86. * No facets defined.
  87. */
  88. public static final short FACET_NONE = 0;
  89. /**
  90. * 4.3.1 Length
  91. */
  92. public static final short FACET_LENGTH = 1;
  93. /**
  94. * 4.3.2 minLength.
  95. */
  96. public static final short FACET_MINLENGTH = 2;
  97. /**
  98. * 4.3.3 maxLength.
  99. */
  100. public static final short FACET_MAXLENGTH = 4;
  101. /**
  102. * 4.3.4 pattern.
  103. */
  104. public static final short FACET_PATTERN = 8;
  105. /**
  106. * 4.3.5 whitespace.
  107. */
  108. public static final short FACET_WHITESPACE = 16;
  109. /**
  110. * 4.3.7 maxInclusive.
  111. */
  112. public static final short FACET_MAXINCLUSIVE = 32;
  113. /**
  114. * 4.3.9 maxExclusive.
  115. */
  116. public static final short FACET_MAXEXCLUSIVE = 64;
  117. /**
  118. * 4.3.9 minExclusive.
  119. */
  120. public static final short FACET_MINEXCLUSIVE = 128;
  121. /**
  122. * 4.3.10 minInclusive.
  123. */
  124. public static final short FACET_MININCLUSIVE = 256;
  125. /**
  126. * 4.3.11 totalDigits .
  127. */
  128. public static final short FACET_TOTALDIGITS = 512;
  129. /**
  130. * 4.3.12 fractionDigits.
  131. */
  132. public static final short FACET_FRACTIONDIGITS = 1024;
  133. /**
  134. * 4.3.5 enumeration.
  135. */
  136. public static final short FACET_ENUMERATION = 2048;
  137. /**
  138. * A constant defined for the 'ordered' fundamental facet: not ordered.
  139. */
  140. public static final short ORDERED_FALSE = 0;
  141. /**
  142. * A constant defined for the 'ordered' fundamental facet: partially
  143. * ordered.
  144. */
  145. public static final short ORDERED_PARTIAL = 1;
  146. /**
  147. * A constant defined for the 'ordered' fundamental facet: total ordered.
  148. */
  149. public static final short ORDERED_TOTAL = 2;
  150. /**
  151. * [variety]: one of {atomic, list, union} or absent.
  152. */
  153. public short getVariety();
  154. /**
  155. * If variety is <code>atomic</code> the primitive type definition (a
  156. * built-in primitive datatype definition or the simple ur-type
  157. * definition) is available, otherwise <code>null</code>.
  158. */
  159. public XSSimpleTypeDefinition getPrimitiveType();
  160. /**
  161. * Returns the closest built-in type category this type represents or
  162. * derived from. For example, if this simple type is a built-in derived
  163. * type integer the <code>INTEGER_DV</code> is returned.
  164. */
  165. public short getBuiltInKind();
  166. /**
  167. * If variety is <code>list</code> the item type definition (an atomic or
  168. * union simple type definition) is available, otherwise
  169. * <code>null</code>.
  170. */
  171. public XSSimpleTypeDefinition getItemType();
  172. /**
  173. * If variety is <code>union</code> the list of member type definitions (a
  174. * non-empty sequence of simple type definitions) is available,
  175. * otherwise an empty <code>XSObjectList</code>.
  176. */
  177. public XSObjectList getMemberTypes();
  178. /**
  179. * [facets]: all facets defined on this type. The value is a bit
  180. * combination of FACET_XXX constants of all defined facets.
  181. */
  182. public short getDefinedFacets();
  183. /**
  184. * Convenience method. [Facets]: check whether a facet is defined on this
  185. * type.
  186. * @param facetName The name of the facet.
  187. * @return True if the facet is defined, false otherwise.
  188. */
  189. public boolean isDefinedFacet(short facetName);
  190. /**
  191. * [facets]: all defined facets for this type which are fixed.
  192. */
  193. public short getFixedFacets();
  194. /**
  195. * Convenience method. [Facets]: check whether a facet is defined and
  196. * fixed on this type.
  197. * @param facetName The name of the facet.
  198. * @return True if the facet is fixed, false otherwise.
  199. */
  200. public boolean isFixedFacet(short facetName);
  201. /**
  202. * Convenience method. Returns a value of a single constraining facet for
  203. * this simple type definition. This method must not be used to retrieve
  204. * values for <code>enumeration</code> and <code>pattern</code> facets.
  205. * @param facetName The name of the facet, i.e.
  206. * <code>FACET_LENGTH, FACET_TOTALDIGITS </code> (see
  207. * <code>XSConstants</code>). To retrieve the value for a pattern or
  208. * an enumeration, see <code>enumeration</code> and
  209. * <code>pattern</code>.
  210. * @return A value of the facet specified in <code>facetName</code> for
  211. * this simple type definition or <code>null</code>.
  212. */
  213. public String getLexicalFacetValue(short facetName);
  214. /**
  215. * A list of enumeration values if it exists, otherwise an empty
  216. * <code>StringList</code>.
  217. */
  218. public StringList getLexicalEnumeration();
  219. /**
  220. * A list of pattern values if it exists, otherwise an empty
  221. * <code>StringList</code>.
  222. */
  223. public StringList getLexicalPattern();
  224. /**
  225. * Fundamental Facet: ordered.
  226. */
  227. public short getOrdered();
  228. /**
  229. * Fundamental Facet: cardinality.
  230. */
  231. public boolean getFinite();
  232. /**
  233. * Fundamental Facet: bounded.
  234. */
  235. public boolean getBounded();
  236. /**
  237. * Fundamental Facet: numeric.
  238. */
  239. public boolean getNumeric();
  240. /**
  241. * A list of constraining facets if it exists, otherwise an empty
  242. * <code>XSObjectList</code>. Note: This method must not be used to
  243. * retrieve values for <code>enumeration</code> and <code>pattern</code>
  244. * facets.
  245. */
  246. public XSObjectList getFacets();
  247. /**
  248. * A list of enumeration and pattern constraining facets if it exists,
  249. * otherwise an empty <code>XSObjectList</code>.
  250. */
  251. public XSObjectList getMultiValueFacets();
  252. /**
  253. * [annotations]: a set of annotations for this simple type component if
  254. * it exists, otherwise an empty <code>XSObjectList</code>.
  255. */
  256. public XSObjectList getAnnotations();
  257. }