# Class ColumnMetadataStage

java.lang.Object
uk.ac.starlink.ttools.taplint.ColumnMetadataStage

All Implemented Interfaces:
  `Stage`

public class ColumnMetadataStage extends Object implements Stage
Validation stage which checks all actual results (SELECT *) against declared metadata.

Since:
  7 Jul 2011
Author:
  Mark Taylor

## Constructor Summary

Constructors
Constructor
Description
`ColumnMetadataStage(TapRunner tapRunner, MetadataHolder metaHolder, int maxTables)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`String`
`getDescription()`
Returns a short one-line description of this stage.
`static String`
`normaliseColumnName(String colName)`
Returns the essence of a column name.
`void`
`run(Reporter reporter, uk.ac.starlink.vo.TapService tapService)`
Performs the validation checks for this stage.
`void`
`setMaxTestTables(int maxTables)`
Resets the limit on the number of tables to test.

### Methods inherited from class Object

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

## Constructor Details

### ColumnMetadataStage

public ColumnMetadataStage(TapRunner tapRunner, MetadataHolder metaHolder, int maxTables)
Constructor.

Parameters:
  `tapRunner` - object that can run TAP queries
  `metaHolder` - provides table metadata at run time
  `maxTables` - limit on the number of tables to test, or <=0 for no limit

## Method Details

### setMaxTestTables

public void setMaxTestTables(int maxTables)
Resets the limit on the number of tables to test.

Parameters:
  `maxTables` - limit on the number of tables to test, or <=0 for no limit

### getDescription

public String getDescription()
Description copied from interface: `Stage`
Returns a short one-line description of this stage.

Specified by:
  `getDescription` in interface `Stage`
Returns:
  description in imperative mood

### run

public void run(Reporter reporter, uk.ac.starlink.vo.TapService tapService)
Description copied from interface: `Stage`
Performs the validation checks for this stage.

Specified by:
  `run` in interface `Stage`
Parameters:
  `reporter` - destination for validation messages
  `tapService` - TAP service description

### normaliseColumnName

public static String normaliseColumnName(String colName)
Returns the essence of a column name. The result is the string that ought to be equal to the name of the same column when it appears somewhere else.

Currently, this does two things: flattens case and unquotes quoted names (delimited identifiers). This is a bit tricky or debatable or controversial. In general unquoting column names is not supposed to be something the client can do for itself, because there may be strange server-specific rules. But it's pretty clear how it would be done if it could be done, and pragmatically it doesn't make sense to flag an error if a column declared in the metadata with name '"size"' comes back in a result table with name 'size'. So this is probably the right thing to do for comparisons.

Parameters:
  `colName` - column name
Returns:
  normalised column name