Package 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 theValueInfo
interface) as well as additional miscellaneous metadata. The miscellaneous, or auxiliary, metadata takes the form of a list ofDescribedValue
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.- Author:
- Mark Taylor (Starlink)
-
-
Constructor Summary
Constructors Constructor Description ColumnInfo(java.lang.String name)
Constructs a ColumnInfo object.ColumnInfo(java.lang.String name, java.lang.Class contentClass, java.lang.String description)
Constructs a new ColumnInfo object with a given name, class and description.ColumnInfo(ColumnInfo base)
Constructs a ColumnInfo object which is a copy of an existing one.ColumnInfo(ValueInfo base)
Constructs a new ColumnInfo based on a ValueInfo object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List
getAuxData()
Returns a list of auxiliary metadataDescribedValue
objects pertaining to this column.DescribedValue
getAuxDatum(ValueInfo vinfo)
Gets an item of auxiliary metadata from its specification.DescribedValue
getAuxDatumByName(java.lang.String name)
Gets an item of auxiliary metadata by its name.java.lang.Object
getAuxDatumValue(ValueInfo vinfo, java.lang.Class clazz)
Gets the value of an item of auxiliary metadata using its specification, requiring a particular return type.java.lang.Object
getAuxDatumValueByName(java.lang.String name, java.lang.Class clazz)
Gets the value of an item of auxiliary metadata by its name, requiring a particular return type.void
setAuxData(java.util.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, getContentClass, getDescription, getDomainMappers, getElementSize, getName, getShape, getUCD, getUnitString, getUtype, isArray, isNullable, setContentClass, setDescription, setDomainMappers, setElementSize, setName, setNullable, setShape, setUCD, setUnitString, setUtype, toString, unformatShape, unformatString
-
-
-
-
Constructor Detail
-
ColumnInfo
public ColumnInfo(java.lang.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(java.lang.String name, java.lang.Class contentClass, java.lang.String description)
Constructs a new ColumnInfo object with a given name, class and description.- Parameters:
name
- the name applying to described valuescontentClass
- the class of which described values should be instancesdescription
- 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 java.util.List getAuxData()
Returns a list of auxiliary metadataDescribedValue
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(java.lang.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 java.lang.Object getAuxDatumValue(ValueInfo vinfo, java.lang.Class clazz)
Gets the value of an item of auxiliary metadata using its specification, requiring a particular return type. This convenience method works likegetAuxDatum(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 matchclazz
- 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 java.lang.Object getAuxDatumValueByName(java.lang.String name, java.lang.Class clazz)
Gets the value of an item of auxiliary metadata by its name, requiring a particular return type. This convenience method works likegetAuxDatumByName(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 itemclazz
- 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(java.util.List auxData)
Sets the list of auxiliary metadata items for this column. All elements of the supplied list should beDescribedValue
objects.- Parameters:
auxData
- a list of DescribedValue objects
-
-