## com.saxonica.validate
Class KeySelectorWatch

    java.lang.Object
      com.saxonica.validate.AbstractWatch
          com.saxonica.validate.SelectorWatch
              com.saxonica.validate.KeySelectorWatch

All Implemented Interfaces:
  Watch

    public class KeySelectorWatch

extends SelectorWatch

This class watches the selector for a key or unique constraint

Constructor Summary
`KeySelectorWatch(ConstraintChecker checker, IdentityConstraint uniqueConstraint)`

Method Summary
`void` `addKeyRef(RefSelectorWatch watch)` Add a RefSelectorWatch to support a keyRef that refers to this key or unique constraints
`protected void` `checkRow(Value[] currentRow, boolean isTarget, int locationId)` Method to check that a row (that is, the collection of fields corresponding to one selected node) is valid.

Methods inherited from class com.saxonica.validate.SelectorWatch
`addFieldValue, close, displayRow, endSelectedParentNode, getIdentityConstraint, reportValidationError, reportValidationError, startSelectedParentNode`

Methods inherited from class com.saxonica.validate.AbstractWatch
`getAnchorNode, getNamespaceResolver, getPipelineConfiguration, getSelection, notifySelectedLeafNode, open, setAnchorNode, setNamespaceResolver, setPipelineConfiguration, setSelection`

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

Methods inherited from interface com.saxonica.stream.watch.Watch
`getAnchorNode, getNamespaceResolver, getPipelineConfiguration, getSelection, notifySelectedLeafNode, open, setAnchorNode, setNamespaceResolver, setPipelineConfiguration, setSelection`

Constructor Detail

### KeySelectorWatch

    public KeySelectorWatch(ConstraintChecker checker,
                            IdentityConstraint uniqueConstraint)

Method Detail

### addKeyRef

    public void addKeyRef(RefSelectorWatch watch)

  Add a RefSelectorWatch to support a keyRef that refers to this key or unique constraints

  Parameters:
    `watch` - the RefSelectorWatch which needs to be notified of all values encountered for this key

### checkRow

    protected void checkRow(Value[] currentRow,
                            boolean isTarget,
                            int locationId)
                     throws ValidationException

  Method to check that a row (that is, the collection of fields corresponding to one selected node) is valid. This implentation augments that in the superclass by notifying all interested keyref's of the values in this row.

  Overrides:
    `checkRow` in class `SelectorWatch`
  Parameters:
    `currentRow` - the values of the set of fields
    `isTarget` - set to true if this is a value of the key referred to by a key reference, rather than a value for this constraint's own selected fields.
    `locationId` - identifies the location of the selected node
  Throws:
    `ValidationException` - May be raised if the value of the row (that is, the combination of fields) violates the constraint

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