There is a one-to-one correspondence between a StarTable
's
ColumnInfo
objects (accessed using
getColumnInfo
)
and the FIELD elements contained in the corresponding TABLE.
The attributes of each fields are interpreted (for reading)
or determined (for writing) in a number of different ways:
datatype
and arraysize
values depend
on the class and shape of objects held in the column.
name
, unit
ucd
and
Utype
values
can be accessed using the corresponding methods on the
ColumnInfo
object
(get/set
Name()
, UnitString()
,
UCD()
and Utype()
respectively).
ID
width
,
precision
and type
are held as String-type auxiliary metadata items in the
ColumnInfo
object, keyed by constants defined by
the VOStarTable
class
(ID_INFO
,
WIDTH_INFO
,
PRECISION_INFO
and
TYPE_INFO
respectively).
ColumnInfo
object, keyed by their
title
or, if it doesn't have one, ID
attribute.
So if you have read a VOTable and want to determine the
name
, ucd
and ID
attributes
of the first column, you can do it like this:
StarTable table = readVOTable(); ColumnInfo col0 = table.getColumnInfo(0); String name0 = col0.getName(); String ucd0 = col0.getUCD(); String id0 = (String) col0.getAuxDatumValue(VOStarTable.ID_INFO, String.class);
And if you are preparing a table to be written
as a VOTable and want to set the
name
, ucd
and ID
attributes
of a certain column, and have it contain an element
<LINK title='docs' href='...'>
"
you can set its ColumnInfo
up like this:
ColumnInfo configureColumn(String name, String ucd, String id, URL docURL) { ColumnInfo info = new ColumnInfo(name); info.setUCD(ucd); info.setAuxDatum(new DescribedValue(VOStarTable.ID_INFO, id)); info.setAuxDatum(new DescribedValue(new URLValueInfo("docs",null), docURL)); return info; }