# Class RefChecker

java.lang.Object
uk.ac.starlink.ttools.votlint.RefChecker

All Implemented Interfaces:
  `AttributeChecker`

Direct Known Subclasses:
  `FieldRefChecker`

public class RefChecker extends Object implements AttributeChecker
Attribute checker for checking XML IDREF type attributes. Facilities are provided for checking that the reference is to elements of a certain sort (for instance, there's no sense in getting a GROUP to reference an INFO).

Since:
  7 Apr 2005
Author:
  Mark Taylor (Starlink)

## Constructor Summary

Constructors
Constructor
Description
`RefChecker(String legalReferent)`
Constructs a RefChecker which can only sensibly reference a single given element type.
`RefChecker(String[] legalReferents)`
Constructs a RefChecker which can only sensibly reference a given list of element types.

## Method Summary

Modifier and Type
Method
Description
`void`
`check(String id, ElementHandler handler)`
Performs a syntactic and/or semantic check on an attribute value for a given element.
`void`
`checkLink(VotLintContext context, String id, ElementRef from, ElementRef to)`
Checks that an IDREF->ID arc is sensible.

### Methods inherited from class Object

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

## Constructor Details

### RefChecker

public RefChecker(String[] legalReferents)
Constructs a RefChecker which can only sensibly reference a given list of element types.

Parameters:
  `legalReferents` - list of element local names which this ref can sensibly point to

### RefChecker

public RefChecker(String legalReferent)
Constructs a RefChecker which can only sensibly reference a single given element type.

Parameters:
  `legalReferent` - sole element local name which this ref can sensibly point to

## Method Details

### check

public void check(String id, ElementHandler handler)
Description copied from interface: `AttributeChecker`
Performs a syntactic and/or semantic check on an attribute value for a given element. Anything worthy of comment should be logged through `handler`'s context.

Specified by:
  `check` in interface `AttributeChecker`
Parameters:
  `id` - the value of the attribute to check
  `handler` - the element on which `attValue` appears

### checkLink

public void checkLink(VotLintContext context, String id, ElementRef from, ElementRef to)
Checks that an IDREF->ID arc is sensible.

Parameters:
  `context` - lint context
  `id` - ID value
  `from` - element with IDREF value of id
  `to` - element with ID value of id