Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.saxonica.schema
Class UserDefinedType

    java.lang.Object
      com.saxonica.schema.SchemaStructure
          com.saxonica.schema.UserDefinedType

All Implemented Interfaces:
  UserSchemaComponent, Serializable, SourceLocator, SchemaComponent, SchemaType

Direct Known Subclasses:
  UserComplexType, UserSimpleType

    public abstract class UserDefinedType

extends SchemaStructure
implements Serializable, UserSchemaComponent, SchemaType

This class represents a user-defined simple type or complex type as defined in XML Schema.

See Also:
  Serialized Form

Field Summary
`protected Set` | `extendedTypes` The set of all the types that are derived by extension from this type
`protected int` | `finalProhibitions` Flags used to implement the "final" and "block" attributes

Fields inherited from interface net.sf.saxon.type.SchemaType
`DERIVATION_EXTENSION, DERIVATION_LIST, DERIVATION_RESTRICTION, DERIVATION_UNION, DERIVE_BY_SUBSTITUTION`

Fields inherited from interface net.sf.saxon.type.SchemaComponent
`FIXED_UP, INCOMPLETE, INVALID, UNVALIDATED, VALIDATED, VALIDATING`

Constructor Summary
`UserDefinedType()` Default constructor.

Method Summary
`boolean` | `allowsDerivation(int derivation)` Determines whether derivation (of a particular kind) from this type is allowed, based on the "final" property
`void` | `checkTypeDerivationIsOK(SchemaType type, int block)` Check that this type is validly derived from a given type
`boolean` | `containingDeclarationIsElement()` Determine whether the containing declaration is an element declaration or an attribute declaration
`SchemaType` | `getBaseType()` Returns the base type that this type inherits from.
`int` | `getBaseTypeFingerprint()` Get the fingerprint of the name of the base type of this type
`TypeReference` | `getBaseTypeReference()` Get the reference to the base type.
`int` | `getBlock()` Returns the value of the 'block' attribute for this type, as a bit-signnificant integer with fields such as `SchemaType.DERIVATION_LIST` and `SchemaType.DERIVATION_EXTENSION`
`int` | `getContainingDeclarationName()` Get the name of the containing element or attribute declaration, if any (and if known).
`int` | `getDerivationMethod()` Gets the integer code of the derivation method used to derive this type from its parent.
`String` | `getDescription()` Get a description of this type for use in diagnostics.
`String` | `getDisplayName()` Get the display name of the type: that is, a lexical QName with an arbitrary prefix
`int` | `getFingerprint()` Get the fingerprint of the name of this type
`String` | `getLocalName()` Deprecated. since 9.0: use the equivalent method `getName()`
`String` | `getName()` Get the local name of this type if it has one
`int` | `getNameCode()` Get the namecode of the name of this type.
`NamePool` | `getNamePool()` Get the NamePool in which the name of this type is defined
`String` | `getTargetNamespace()` Get the namespace URI of the name of this type if it has one
`boolean` | `hasRegisteredExtension(UserComplexType extension)` Determine whether a particular complex type is among the registered extensions of this type
`boolean` | `isAnonymousType()` Test whether this is an anonymous type
`boolean` | `isComplexType()` Test whether this SchemaType is a complex type
`boolean` | `isExternalType()` Return true if this is an external object type, that is, a Saxon-defined type for external Java or .NET objects
`boolean` | `isSameType(SchemaType other)` Test whether this is the same type as another type.
`Iterator` | `iterateExtensionTypes()` Iterate over all the types defined as extensions of this type, transitively
`protected void` | `registerExtensionType(UserComplexType derived)` Register another type as an extension of this type
`void` | `setBaseTypeReference(TypeReference baseType)` Sets the base type for this datatype.
`void` | `setContainingDeclaration(int fingerprint, boolean isElement)` Set the name of the containing declaration (for diagnostics)
`void` | `setDerivationMethod(int method)` Sets the derivation method code (without validating it)
`void` | `setDerivationMethodName(String method)` Set the derivation method name.
`void` | `setExtendedTypes(Set types)` Set the set of types derived by extension from this one
`void` | `setFinalProhibitions(int finalValue)` Sets the value of the 'final' property, indicating which types of derivation are not allowed.
`void` | `setNameCode(int nameCode)` Set the nameCode of the name of this type.

Methods inherited from class com.saxonica.schema.SchemaStructure
`elaborate, fixup, getColumnNumber, getConfiguration, getFixupStatus, getLineNumber, getPublicId, getRedefinitionLevel, getSchemaDocumentURI, getSystemId, getValidationStatus, lookForCycles, setConfiguration, setFixupStatus, setLineNumber, setLocator, setRedefinitionLevel, setSchemaDocumentURI, setSystemId, setValidationStatus`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface com.saxonica.schema.UserSchemaComponent
`elaborate, fixup, lookForCycles, validate`

Methods inherited from interface net.sf.saxon.type.SchemaType
`analyzeContentExpression, atomize, getSystemId, getTypedValue, isAtomicType, isIdRefType, isIdType, isSimpleType`

Methods inherited from interface net.sf.saxon.type.SchemaComponent
`getRedefinitionLevel, getValidationStatus`

Field Detail

### finalProhibitions

    protected int finalProhibitions

  Flags used to implement the "final" and "block" attributes

### extendedTypes

    protected Set extendedTypes

  The set of all the types that are derived by extension from this type

Constructor Detail

### UserDefinedType

    public UserDefinedType()

  Default constructor. For internal use only.

Method Detail

### getName

    public String getName()

  Get the local name of this type if it has one

  Specified by:
    `getName` in interface `SchemaType`
  Returns:
    the local name of this type definition, if it has one. Return null in the case of an anonymous type.

### getTargetNamespace

    public String getTargetNamespace()

  Get the namespace URI of the name of this type if it has one

  Specified by:
    `getTargetNamespace` in interface `SchemaType`
  Returns:
    the target namespace of this type definition, if it has one. Return null in the case of an anonymous type, and in the case of a global type defined in a no-namespace schema.

### isExternalType

    public boolean isExternalType()

  Return true if this is an external object type, that is, a Saxon-defined type for external Java or .NET objects

### getFingerprint

    public int getFingerprint()

  Get the fingerprint of the name of this type

  Specified by:
    `getFingerprint` in interface `SchemaType`
  Returns:
    the fingerprint. Returns an invented fingerprint for an anonymous type.

### getNameCode

    public int getNameCode()

  Get the namecode of the name of this type. This includes the prefix from the original type declaration: in the case of built-in types, this will be a conventional prefix such as "xs" or "xdt".

  Specified by:
    `getNameCode` in interface `SchemaType`
  Returns:
    the namecode. Returns an invented namecode for an anonymous type.

### isAnonymousType

    public boolean isAnonymousType()

  Test whether this is an anonymous type

  Specified by:
    `isAnonymousType` in interface `SchemaType`
  Returns:
    true if this SchemaType is an anonymous type

### setNameCode

    public void setNameCode(int nameCode)

  Set the nameCode of the name of this type. For internal use only.

  Parameters:
    `nameCode` - the nameCode allocated in the namepool for this schema

### getBaseTypeReference

    public TypeReference getBaseTypeReference()

  Get the reference to the base type. The result is never null, except in the case of the type AnyType, which is the root of the type hierarchy.

### getBaseTypeFingerprint

    public int getBaseTypeFingerprint()

  Get the fingerprint of the name of the base type of this type

  Returns:
    the fingerprint. Return an invented fingerprint for an anonymous type.

### getLocalName

    public String getLocalName()

  Deprecated. since 9.0: use the equivalent method `getName()`

  Get the local name of this type

  Returns:
    the local part of the name, or null if the type is anonymous

### getDisplayName

    public String getDisplayName()

  Get the display name of the type: that is, a lexical QName with an arbitrary prefix

  Specified by:
    `getDisplayName` in interface `SchemaType`
  Returns:
    a lexical QName identifying the type

### isComplexType

    public final boolean isComplexType()

  Test whether this SchemaType is a complex type

  Specified by:
    `isComplexType` in interface `SchemaType`
  Returns:
    true if this SchemaType is a complex type

### getBlock

    public int getBlock()

  Returns the value of the 'block' attribute for this type, as a bit-signnificant integer with fields such as `SchemaType.DERIVATION_LIST` and `SchemaType.DERIVATION_EXTENSION`

  Specified by:
    `getBlock` in interface `SchemaType`
  Returns:
    the value of the 'block' attribute for this type

### getNamePool

    public NamePool getNamePool()

  Get the NamePool in which the name of this type is defined

### getBaseType

    public SchemaType getBaseType()
                           throws UnresolvedReferenceException

  Returns the base type that this type inherits from. If this type is a Simpletype that is a built in primitive type then null is returned.

  Specified by:
    `getBaseType` in interface `SchemaType`
  Returns:
    the base type.
  Throws:
    `UnresolvedReferenceException` - if this type has no known base type. This can only arise during schema construction, since a type with an unknown base type cannot be used for validation

### setBaseTypeReference

    public void setBaseTypeReference(TypeReference baseType)

  Sets the base type for this datatype. For internal use only.

  Parameters:
    `baseType` - the base type which this type inherits from

### getDerivationMethod

    public int getDerivationMethod()

  Gets the integer code of the derivation method used to derive this type from its parent. Returns zero for primitive types.

  Specified by:
    `getDerivationMethod` in interface `SchemaType`
  Returns:
    a numeric code representing the derivation method, for example `SchemaType.DERIVATION_RESTRICTION`

### allowsDerivation

    public boolean allowsDerivation(int derivation)

  Determines whether derivation (of a particular kind) from this type is allowed, based on the "final" property

  Specified by:
    `allowsDerivation` in interface `SchemaType`
  Parameters:
    `derivation` - the kind of derivation, for example `SchemaType.DERIVATION_LIST`
  Returns:
    true if this kind of derivation is allowed

### setDerivationMethodName

    public void setDerivationMethodName(String method)
                                 throws SchemaException

  Set the derivation method name. For internal use only.

  Parameters:
    `method` - the derivation method, for example "restriction"
  Throws:
    `SchemaException` - for an unknown derivation method

### setDerivationMethod

    public void setDerivationMethod(int method)

  Sets the derivation method code (without validating it)

  Parameters:
    `method` - the derivation method as an integer code, for example `SchemaType.DERIVATION_UNION`

### setFinalProhibitions

    public void setFinalProhibitions(int finalValue)

  Sets the value of the 'final' property, indicating which types of derivation are not allowed. For internal use only.

  Parameters:
    `finalValue` - the value of the final property, as a bit-significant integer

### checkTypeDerivationIsOK

    public void checkTypeDerivationIsOK(SchemaType type,
                                        int block)
                                 throws SchemaException

  Check that this type is validly derived from a given type

  Specified by:
    `checkTypeDerivationIsOK` in interface `SchemaType`
  Parameters:
    `type` - the type from which this type is derived
    `block` - the derivations that are blocked by the relevant element declaration
  Throws:
    `SchemaException` - if the derivation is not allowed

### setContainingDeclaration

    public void setContainingDeclaration(int fingerprint,
                                         boolean isElement)

  Set the name of the containing declaration (for diagnostics)

  Parameters:
    `fingerprint` - The fingerprint of the element or attribute declaration "owning" this anonymous type definition
    `isElement` - True if the owning declaration is an element declaration, false if it is an attribute declaration

### getDescription

    public String getDescription()

  Get a description of this type for use in diagnostics. In the case of a named type, this is the same as the display name. In the case of a type known to be defined immediately within an element or attribute declaration, it is a phrase that identifies the containing declaration. In other cases, it is a phrase of the form "defined at line L of URI". The description is designed to be inserted in a context such as "the type X is ..."

  Specified by:
    `getDescription` in interface `SchemaType`
  Returns:
    text identifing the type, for use in a phrase such as "the type XXXX".

### getContainingDeclarationName

    public int getContainingDeclarationName()

  Get the name of the containing element or attribute declaration, if any (and if known).

  Returns:
    the name of the containing declaration, as a NamePool fingerprint.

### containingDeclarationIsElement

    public boolean containingDeclarationIsElement()

  Determine whether the containing declaration is an element declaration or an attribute declaration

  Returns:
    true if the containin declaration is an element declaration, false if it is an attribute

### isSameType

    public boolean isSameType(SchemaType other)

  Test whether this is the same type as another type. They are considered to be the same type if they are derived from the same type definition in the original XML representation (which can happen when there are multiple includes of the same file)

  Specified by:
    `isSameType` in interface `SchemaType`
  Parameters:
    `other` - the other type
  Returns:
    true if this is the same type as other

### registerExtensionType

    protected void registerExtensionType(UserComplexType derived)

  Register another type as an extension of this type

  Parameters:
    `derived` - the type that is derived from this one by extension

### iterateExtensionTypes

    public Iterator iterateExtensionTypes()

  Iterate over all the types defined as extensions of this type, transitively

  Returns:
    an iterator over the complex types derived by extension from this type, either directly or indirectly

### hasRegisteredExtension

    public boolean hasRegisteredExtension(UserComplexType extension)

  Determine whether a particular complex type is among the registered extensions of this type

  Parameters:
    `extension` - the type to be tested to see whether it is an extension of this one
  Returns:
    true if the specified type is derived by extension from this type

### setExtendedTypes

    public void setExtendedTypes(Set types)

  Set the set of types derived by extension from this one

  Parameters:
    `types` - the set of extended types

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) 2004-2010 Saxonica Limited. All rights reserved.