Package net.sf.saxon.trans

## Class KeyDefinitionSet

- java.lang.Object
- - net.sf.saxon.trans.KeyDefinitionSet

-     public class KeyDefinitionSet
      extends java.lang.Object

  A set of xsl:key definitions in a stylesheet that share the same name

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `KeyDefinitionSet​(StructuredQName keyName, int keySetNumber)` | Create a key definition set for keys sharing a given name

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `addKeyDefinition​(KeyDefinition keyDef)` | Add a key definition to this set of key definitions.
    `java.lang.String` | `getCollationName()` | Get the name of the collation used for this key
    `java.util.List<KeyDefinition>` | `getKeyDefinitions()` | Get the key definitions in this set
    `StructuredQName` | `getKeyName()` | Get the name of the key definitions in this set (they all share the same name)
    `int` | `getKeySetNumber()` | Get the KeySet number.
    `boolean` | `isBackwardsCompatible()` | Ask if the keys are to be evaluated in backwards compatible mode
    `boolean` | `isComposite()` | Ask whether this is a composite key
    `boolean` | `isRangeKey()` | Ask if this is a range key
    `boolean` | `isReusable()` | Ask whether this key definition set is reusable across transformations, that is, if the index built for a particular document is shareable across transformations.
    `void` | `setReusable​(boolean reusable)` | Say whether this key definition set is reusable across transformations, that is, if the index built for a particular document is shareable across transformations.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### KeyDefinitionSet

          public KeyDefinitionSet​(StructuredQName keyName,
                                  int keySetNumber)

      Create a key definition set for keys sharing a given name
      Parameters:
        `keyName` - the name of the key definitions in this set
        `keySetNumber` - a unique number identifying this key definition set

  - ### Method Detail

    - #### addKeyDefinition

          public void addKeyDefinition​(KeyDefinition keyDef)
                                throws XPathException

      Add a key definition to this set of key definitions. The caller is responsible for ensuring that all key definitions in a key definition set have the same name
      Parameters:
        `keyDef` - the key definition to be added
      Throws:
        `XPathException` - if the key definition uses a different collation from others in the set

    - #### getKeyName

          public StructuredQName getKeyName()

      Get the name of the key definitions in this set (they all share the same name)
      Returns:
        the name of these key definitions

    - #### getCollationName

          public java.lang.String getCollationName()

      Get the name of the collation used for this key
      Returns:
        the collation name (a URI)

    - #### isComposite

          public boolean isComposite()

      Ask whether this is a composite key
      Returns:
        true if the key is composite

    - #### getKeySetNumber

          public int getKeySetNumber()

      Get the KeySet number. This uniquely identifies the KeyDefinitionSet within a KeyManager
      Returns:
        the unique number

    - #### getKeyDefinitions

          public java.util.List<KeyDefinition> getKeyDefinitions()

      Get the key definitions in this set
      Returns:
        the key definitions in this set

    - #### isBackwardsCompatible

          public boolean isBackwardsCompatible()

      Ask if the keys are to be evaluated in backwards compatible mode
      Returns:
        true if backwards compatibility is in force for at least one of the keys in the set

    - #### isRangeKey

          public boolean isRangeKey()

      Ask if this is a range key
      Returns:
        true if any of the keys in the set is defined as a range key

    - #### setReusable

          public void setReusable​(boolean reusable)

      Say whether this key definition set is reusable across transformations, that is, if the index built for a particular document is shareable across transformations. This will only be the case if the key has no dependencies on global variables or parameters in the stylesheet
      Parameters:
        `reusable` - set to true if the index can safely be shared and reused

    - #### isReusable

          public boolean isReusable()

      Ask whether this key definition set is reusable across transformations, that is, if the index built for a particular document is shareable across transformations. This will only be the case if the key has no dependencies on global variables or parameters in the stylesheet
      Returns:
        true if the index can safely be shared and reused