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).
LINK
elements are represented by URL-type
auxiliary metadata
items in the ColumnInfo
object, keyed by their
title
or, if it doesn't have one, ID
attribute.
Tables.NULL_VALUE_INFO
auxiliary metadata item.unsignedByte
values are marked with
a Boolean.TRUE
value of their
Tables.UBYTE_FLAG_INFO
auxiliary metadata item, as well as having a java short
integer data type (the java byte
type is no good because
it's signed).So if you have read a VOTable and want to determine the
name
, ucd
and ID
attributes
of the first column and its magic blank value, 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); Number blank0 = (Number) col0.getAuxDatumValue(Tables.NULL_VALUE_INFO, Number.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, fix it to use a particular magic null integer value,
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, Number blank, URL docURL) { ColumnInfo info = new ColumnInfo(name); info.setUCD(ucd); info.setAuxDatum(new DescribedValue(VOStarTable.ID_INFO, id)); info.setAuxDatum(new DescribedValue(Tables.NULL_VALUE_INFO, blank)); info.setAuxDatum(new DescribedValue(new URLValueInfo("docs",null), docURL)); return info; }