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