org.apache.xerces.xs

## Interface XSTypeDefinition

- All Superinterfaces:
    XSObject
  All Known Subinterfaces:
    XSComplexTypeDefinition, XSSimpleTypeDefinition

      public interface XSTypeDefinition
      extends XSObject

  This interface represents a complex or simple type definition.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static short` | `COMPLEX_TYPE` The object describes a complex type.
    `static short` | `SIMPLE_TYPE` The object describes a simple type.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `derivedFrom(java.lang.String namespace, java.lang.String name, short derivationMethod)` Convenience method which checks if this type is derived from the given ancestor type.
    `boolean` | `derivedFromType(XSTypeDefinition ancestorType, short derivationMethod)` Convenience method which checks if this type is derived from the given `ancestorType`.
    `boolean` | `getAnonymous()` Convenience attribute.
    `XSTypeDefinition` | `getBaseType()` {base type definition}: either a simple type definition or a complex type definition.
    `XSObject` | `getContext()` A property that simplifies testing for the identity of anonymous type definitions.
    `short` | `getFinal()` For complex types the returned value is a bit combination of the subset of {`DERIVATION_EXTENSION, DERIVATION_RESTRICTION`} corresponding to `final` set of this type or `DERIVATION_NONE`.
    `short` | `getTypeCategory()` Return whether this type definition is a simple type or complex type.
    `boolean` | `isFinal(short restriction)` {final}.

    - ### Methods inherited from interface org.apache.xerces.xs.XSObject

      `getName, getNamespace, getNamespaceItem, getType`

- - ### Field Detail

    - #### COMPLEX_TYPE

          static final short COMPLEX_TYPE

      The object describes a complex type.
      See Also:
        Constant Field Values

    - #### SIMPLE_TYPE

          static final short SIMPLE_TYPE

      The object describes a simple type.
      See Also:
        Constant Field Values

  - ### Method Detail

    - #### getTypeCategory

          short getTypeCategory()

      Return whether this type definition is a simple type or complex type.

    - #### getBaseType

          XSTypeDefinition getBaseType()

      {base type definition}: either a simple type definition or a complex type definition.

    - #### isFinal

          boolean isFinal(short restriction)

      {final}. For a complex type definition it is a subset of {extension, restriction}. For a simple type definition it is a subset of {extension, list, restriction, union}.
      Parameters:
        `restriction` - Extension, restriction, list, union constants (defined in `XSConstants`).
      Returns:
        True if `restriction` is in the final set, otherwise false.

    - #### getFinal

          short getFinal()

      For complex types the returned value is a bit combination of the subset of {`DERIVATION_EXTENSION, DERIVATION_RESTRICTION`} corresponding to `final` set of this type or `DERIVATION_NONE`. For simple types the returned value is a bit combination of the subset of { `DERIVATION_RESTRICTION, DERIVATION_EXTENSION, DERIVATION_UNION, DERIVATION_LIST` } corresponding to `final` set of this type or `DERIVATION_NONE`.

    - #### getAnonymous

          boolean getAnonymous()

      Convenience attribute. A boolean that specifies if the type definition is anonymous.

    - #### derivedFromType

          boolean derivedFromType(XSTypeDefinition ancestorType,
                                short derivationMethod)

      Convenience method which checks if this type is derived from the given `ancestorType`.
      Parameters:
        `ancestorType` - An ancestor type definition.
        `derivationMethod` - A bit combination representing a subset of { `DERIVATION_RESTRICTION, DERIVATION_EXTENSION, DERIVATION_UNION, DERIVATION_LIST` }.
      Returns:
        True if this type is derived from `ancestorType` using only derivation methods from the `derivationMethod` .

    - #### derivedFrom

          boolean derivedFrom(java.lang.String namespace,
                            java.lang.String name,
                            short derivationMethod)

      Convenience method which checks if this type is derived from the given ancestor type.
      Parameters:
        `namespace` - An ancestor type namespace.
        `name` - An ancestor type name.
        `derivationMethod` - A bit combination representing a subset of { `DERIVATION_RESTRICTION, DERIVATION_EXTENSION, DERIVATION_UNION, DERIVATION_LIST` }.
      Returns:
        True if this type is derived from `ancestorType` using only derivation methods from the `derivationMethod` .

    - #### getContext

          XSObject getContext()

      A property that simplifies testing for the identity of anonymous type definitions. For complex type definition: 1. If the name [attribute] is present (with the exception of the type being redefined, number 2 below), then absent, otherwise the Element Declaration corresponding to that parent information item 2. In the case of redefine, the context of the redefined complex type is the redefining complex type definition For simple type definition, 1. If the name [attribute] is present (with the exception of the type being redefined, number 3 below), then absent 2. otherwise the appropriate case among the following: 2.1 If the parent element information item is attribute, then the corresponding Attribute Declaration 2.2 If the parent element information item is element, then the corresponding Element Declaration 2.3 If the parent element information item is list or union, then the Simple Type Definition corresponding to the grandparent simpleType element information item 2.4 otherwise (the parent element information item is restriction), the appropriate case among the following: 2.4.1 If the grandparent element information item is simpleType, then the Simple Type Definition corresponding to the grandparent 2.4.2 otherwise (the grandparent element information item is simpleContent), the Simple Type Definition which is the {content type} of the Complex Type Definition corresponding to the great-grandparent complexType element information item. 3. In the case of redefine, the context of the redefined simple type is the redefining simple type definition

Copyright © 1999-2022 The Apache Software Foundation. All Rights Reserved.