com.saxonica.schema

## Class IdentityConstraintReference

- java.lang.Object
- - com.saxonica.schema.SchemaStructure
  - - com.saxonica.schema.IdentityConstraintReference

- All Implemented Interfaces:
    ComponentReference, Serializable, SourceLocator

      public class IdentityConstraintReference
      extends SchemaStructure
      implements ComponentReference

  A reference to an identity constraint
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `IdentityConstraintReference()` Create a new uninitialized IdentityConstraint reference (used during schema model loading)
    `IdentityConstraintReference(int fingerprint, int kind, EnterpriseConfiguration config, SourceLocator locator)` Creates a new IdentityConstraint reference

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getExpectedKindOfConstraint()` Get the expected kind of constraint
    `int` | `getFingerprint()` Get the fingerprint of the target of this reference
    `int` | `getSymbolSpace()` Get the symbol space of the target of this reference
    `IdentityConstraint` | `getTarget()` Returns the identity constraint that this type reference is a reference to
    `boolean` | `isResolved()` Determine whether this reference has been resolved
    `void` | `setTarget(IdentityConstraint target)` Set the target of this reference.
    `void` | `tryToResolve(SchemaCompiler compiler)` Attempt to resolve this reference using the constraints defined in a given schema.

    - ### Methods inherited from class com.saxonica.schema.SchemaStructure

      `elaborate, fixup, getColumnNumber, getConfiguration, getFixupStatus, getLineNumber, getPublicId, getRedefinitionLevel, getSchemaDocumentURI, getSystemId, getValidationStatus, lookForCycles, makeXPathExpressionPropertyRecord, 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.ComponentReference

      `getConfiguration`

    - ### Methods inherited from interface javax.xml.transform.SourceLocator

      `getColumnNumber, getLineNumber, getPublicId, getSystemId`

- - ### Constructor Detail

    - #### IdentityConstraintReference

          public IdentityConstraintReference()

      Create a new uninitialized IdentityConstraint reference (used during schema model loading)

    - #### IdentityConstraintReference

          public IdentityConstraintReference(int fingerprint,
                                     int kind,
                                     EnterpriseConfiguration config,
                                     SourceLocator locator)

      Creates a new IdentityConstraint reference
      Parameters:
        `fingerprint` - the name pool fingerprint of the name of the constraint being referenced
        `kind` - the name pool fingerprint of the kind of constraint being referenced, e.g. xs:unique
        `config` - identifies the XML Schema in which this type reference appears. May be null if the reference is in a built-in type
        `locator` - the SourceLocator identifying the location of the reference. May be null if the reference is in a built-in type

  - ### Method Detail

    - #### getExpectedKindOfConstraint

          public int getExpectedKindOfConstraint()

      Get the expected kind of constraint
      Returns:
        one of `StandardNames.XS_UNIQUE`, `StandardNames.XS_KEY`, `StandardNames.XS_KEYREF`

    - #### isResolved

          public boolean isResolved()

      Determine whether this reference has been resolved
      Specified by:
        `isResolved` in interface `ComponentReference`
      Returns:
        true if the reference has been resolved to a schema component

    - #### setTarget

          public void setTarget(IdentityConstraint target)

      Set the target of this reference. Caller is responsible for ensuring that the target constraint is of the expected kind
      Parameters:
        `target` - the target constraint (to which this is a reference)

    - #### getFingerprint

          public int getFingerprint()

      Description copied from interface: `ComponentReference`
      Get the fingerprint of the target of this reference
      Specified by:
        `getFingerprint` in interface `ComponentReference`
      Returns:
        the integer fingerprint of the component name

    - #### getSymbolSpace

          public int getSymbolSpace()

      Get the symbol space of the target of this reference
      Specified by:
        `getSymbolSpace` in interface `ComponentReference`
      Returns:
        an integer code identifying the symbol space

    - #### getTarget

          public IdentityConstraint getTarget()
                                       throws UnresolvedReferenceException

      Returns the identity constraint that this type reference is a reference to
      Specified by:
        `getTarget` in interface `ComponentReference`
      Returns:
        the schema component if the reference has been resolved.
      Throws:
        `UnresolvedReferenceException` - if the reference has not been resolved. Note that this is an unchecked exception.

    - #### tryToResolve

          public void tryToResolve(SchemaCompiler compiler)

      Attempt to resolve this reference using the constraints defined in a given schema. No error results if the reference cannot be resolved.
      Specified by:
        `tryToResolve` in interface `ComponentReference`
      Parameters:
        `compiler` - The compiler being used to compile the referring component. This is assumed to know about the schema containing the candidate target components for the reference. If null, the schema containing the reference is used.

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