uk.ac.starlink.table
Class ColumnInfo

java.lang.Object
  |
  +--uk.ac.starlink.table.DefaultValueInfo
        |
        +--uk.ac.starlink.table.ColumnInfo
All Implemented Interfaces:
ValueInfo

public class ColumnInfo
extends DefaultValueInfo

Contains information about a table column. This includes a description of the values contained in it (as per the ValueInfo interface) as well as additional miscellaneous metadata. The miscellaneous, or auxiliary, metadata takes the form of a list of DescribedValue objects. It is the intention that only one object in this list exists for each value name (as returned by the DescribedValue.getName method. This restriction is not guaranteed to be enforced however.


Constructor Summary
ColumnInfo(ColumnInfo base)
          Constructs a ColumnInfo object which is a copy of an existing one.
ColumnInfo(String name)
          Constructs a ColumnInfo object.
ColumnInfo(String name, Class contentClass, String description)
          Constructs a new ColumnInfo object with a given name, class and description.
ColumnInfo(ValueInfo base)
          Constructs a new ColumnInfo based on a ValueInfo object.
 
Method Summary
 List getAuxData()
          Returns a list of auxiliary metadata DescribedValue objects pertaining to this column.
 DescribedValue getAuxDatum(ValueInfo vinfo)
          Gets an item of auxiliary metadata from its specification.
 DescribedValue getAuxDatumByName(String name)
          Gets an item of auxiliary metadata by its name.
 Object getAuxDatumValue(ValueInfo vinfo, Class clazz)
          Gets the value of an item of auxiliary metadata using its specification, requiring a particular return type.
 Object getAuxDatumValueByName(String name, Class clazz)
          Gets the value of an item of auxiliary metadata by its name, requiring a particular return type.
 void setAuxData(List auxData)
          Sets the list of auxiliary metadata items for this column.
 void setAuxDatum(DescribedValue dval)
          Adds the given DescribedValue to the list of auxiliary metadata for this object.
 
Methods inherited from class uk.ac.starlink.table.DefaultValueInfo
formatClass, formatShape, formatValue, generalise, getCellEditor, getCellRenderer, getContentClass, getDescription, getElementSize, getName, getShape, getUCD, getUnitString, isArray, isNullable, setContentClass, setDescription, setElementSize, setName, setNullable, setShape, setUCD, setUnitString, toString, unformatString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ColumnInfo

public ColumnInfo(String name)
Constructs a ColumnInfo object.

Parameters:
name - the name of the column

ColumnInfo

public ColumnInfo(ValueInfo base)
Constructs a new ColumnInfo based on a ValueInfo object. All attributes are copied from the template to the new object.

Parameters:
base - the template ValueInfo

ColumnInfo

public ColumnInfo(String name,
                  Class contentClass,
                  String description)
Constructs a new ColumnInfo object with a given name, class and description.

Parameters:
name - the name applying to described values
contentClass - the class of which described values should be instances
description - a textual description of the described values

ColumnInfo

public ColumnInfo(ColumnInfo base)
Constructs a ColumnInfo object which is a copy of an existing one.

Parameters:
base - the template ColumnInfo
Method Detail

getAuxData

public List getAuxData()
Returns a list of auxiliary metadata DescribedValue objects pertaining to this column. This is intended as a repository for metadata which is not defined in the ValueInfo interface.

Returns:
a List of DescribedValue items

getAuxDatumByName

public DescribedValue getAuxDatumByName(String name)
Gets an item of auxiliary metadata by its name.

Parameters:
name - the name of an auxiliary metadata item
Returns:
a DescribedValue object representing the named auxiliary metadata item for this column, or null if none exists

getAuxDatum

public DescribedValue getAuxDatum(ValueInfo vinfo)
Gets an item of auxiliary metadata from its specification. Currently this just calls getAuxDatumByName(vinfo.getName()), but may be revised in future to match on other attributes.

Parameters:
vinfo - the data item to match
Returns:
a DescribedValue object representing the auxiliary metadata item matching vinfo for this column, or null if none exists

getAuxDatumValue

public Object getAuxDatumValue(ValueInfo vinfo,
                               Class clazz)
Gets the value of an item of auxiliary metadata using its specification, requiring a particular return type. This convenience method works like getAuxDatum(uk.ac.starlink.table.ValueInfo) but returns a non-null value only if the named item exists and if its value is an instance of the given type clazz.

Parameters:
vinfo - the data item to match
clazz - required return type
Returns:
value of the auxiliary metadata item matching vinfo for this column if it exists and is an instance of clazz or one of its subtypes, otherwise null

getAuxDatumValueByName

public Object getAuxDatumValueByName(String name,
                                     Class clazz)
Gets the value of an item of auxiliary metadata by its name, requiring a particular return type. This convenience method works like getAuxDatumByName(java.lang.String), but returns a non-null value only if the named item exists, and if its value is an instance of the given type clazz.

Parameters:
name - the name of an auxiliary metadata item
clazz - required return type
Returns:
value of the auxiliary metadata item matching vinfo for this column if it exists and is an instance of clazz or one of its subtypes, otherwise null

setAuxDatum

public void setAuxDatum(DescribedValue dval)
Adds the given DescribedValue to the list of auxiliary metadata for this object. If an item in the metadata list with the same name as the supplied value already exists, it is removed from the list.

Parameters:
dval - the new datum to add

setAuxData

public void setAuxData(List auxData)
Sets the list of auxiliary metadata items for this column. All elements of the supplied list should be DescribedValue objects.

Parameters:
auxData - a list of DescribedValue objects

Copyright © 2004 CLRC: Central Laboratory of the Research Councils. All rights reserved.