Package uk.ac.starlink.vo.datalink
Class LinkColMap
- java.lang.Object
-
- uk.ac.starlink.vo.datalink.LinkColMap
-
public class LinkColMap extends java.lang.ObjectDefines the mapping of columns named by the DataLink standard to a given table.The usual way to obtain an instance of this class is using the static
getMapmethod.- Since:
- 22 Nov 2017
- Author:
- Mark Taylor
- See Also:
- DataLink-1.0, sec 3.2
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLinkColMap.ColDef<C>Utility class that encapsulates the characteristics of a given column from the DataLink standard.
-
Field Summary
Fields Modifier and Type Field Description static LinkColMap.ColDef<java.lang.String>COL_ACCESSURLaccess_url column definition.static LinkColMap.ColDef<java.lang.Number>COL_CONTENTLENGTHcontent_length column definition.static LinkColMap.ColDef<java.lang.String>COL_CONTENTTYPEcontent_type column definition.static LinkColMap.ColDef<java.lang.String>COL_DESCRIPTIONdescription column definition.static LinkColMap.ColDef<java.lang.String>COL_ERRORMESSAGEerror_message column definition.static LinkColMap.ColDef<java.lang.String>COL_IDID column definition.static LinkColMap.ColDef<java.lang.String>COL_SEMANTICSsemantics column definition.static LinkColMap.ColDef<java.lang.String>COL_SERVICEDEFservice_def column definition.static java.util.Map<java.lang.String,LinkColMap.ColDef<?>>COLDEF_MAPMap by column name of all columns required in a DataLink table.
-
Constructor Summary
Constructors Modifier Constructor Description protectedLinkColMap(java.util.Map<LinkColMap.ColDef<?>,java.lang.Integer> icolMap)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetAccessUrl(java.lang.Object[] row)Returns the value of the DataLink access_url column in a given row.java.lang.LonggetContentLength(java.lang.Object[] row)Returns the value of the DataLink content_length column in a given row.java.lang.StringgetContentType(java.lang.Object[] row)Returns the value of the DataLink content_type column in a given row.java.lang.StringgetDescription(java.lang.Object[] row)Returns the value of the DataLink description column in a given row.java.lang.StringgetErrorMessage(java.lang.Object[] row)Returns the value of the DataLink error_message column in a given row.java.lang.StringgetId(java.lang.Object[] row)Returns the value of the DataLink id column in a given row.static LinkColMapgetMap(uk.ac.starlink.table.StarTable table)Constructs a LinkColMap that knows where the DataLink columns are in a supplied table.java.lang.StringgetSemantics(java.lang.Object[] row)Returns the value of the DataLink semantics column in a given row.java.lang.StringgetServiceDef(java.lang.Object[] row)Returns the value of the DataLink service_def column in a given row.<C> CgetValue(LinkColMap.ColDef<C> col, java.lang.Object[] row)Returns the typed corresponding to a given column definition in a given row.
-
-
-
Field Detail
-
COL_ID
public static final LinkColMap.ColDef<java.lang.String> COL_ID
ID column definition.
-
COL_ACCESSURL
public static final LinkColMap.ColDef<java.lang.String> COL_ACCESSURL
access_url column definition.
-
COL_SERVICEDEF
public static final LinkColMap.ColDef<java.lang.String> COL_SERVICEDEF
service_def column definition.
-
COL_ERRORMESSAGE
public static final LinkColMap.ColDef<java.lang.String> COL_ERRORMESSAGE
error_message column definition.
-
COL_DESCRIPTION
public static final LinkColMap.ColDef<java.lang.String> COL_DESCRIPTION
description column definition.
-
COL_SEMANTICS
public static final LinkColMap.ColDef<java.lang.String> COL_SEMANTICS
semantics column definition.
-
COL_CONTENTTYPE
public static final LinkColMap.ColDef<java.lang.String> COL_CONTENTTYPE
content_type column definition.
-
COL_CONTENTLENGTH
public static final LinkColMap.ColDef<java.lang.Number> COL_CONTENTLENGTH
content_length column definition.
-
COLDEF_MAP
public static final java.util.Map<java.lang.String,LinkColMap.ColDef<?>> COLDEF_MAP
Map by column name of all columns required in a DataLink table.
-
-
Constructor Detail
-
LinkColMap
protected LinkColMap(java.util.Map<LinkColMap.ColDef<?>,java.lang.Integer> icolMap)
Constructor.- Parameters:
icolMap- map from column definition to column index, providing the state of this object
-
-
Method Detail
-
getId
public java.lang.String getId(java.lang.Object[] row)
Returns the value of the DataLink id column in a given row.- Parameters:
row- row from the table for which this map was prepared- Returns:
- cell value for the
idcolumn
-
getAccessUrl
public java.lang.String getAccessUrl(java.lang.Object[] row)
Returns the value of the DataLink access_url column in a given row.- Parameters:
row- row from the table for which this map was prepared- Returns:
- cell value for the
access_urlcolumn
-
getServiceDef
public java.lang.String getServiceDef(java.lang.Object[] row)
Returns the value of the DataLink service_def column in a given row.- Parameters:
row- row from the table for which this map was prepared- Returns:
- cell value for the
service_defcolumn
-
getErrorMessage
public java.lang.String getErrorMessage(java.lang.Object[] row)
Returns the value of the DataLink error_message column in a given row.- Parameters:
row- row from the table for which this map was prepared- Returns:
- cell value for the
error_messagecolumn
-
getDescription
public java.lang.String getDescription(java.lang.Object[] row)
Returns the value of the DataLink description column in a given row.- Parameters:
row- row from the table for which this map was prepared- Returns:
- cell value for the
descriptioncolumn
-
getSemantics
public java.lang.String getSemantics(java.lang.Object[] row)
Returns the value of the DataLink semantics column in a given row.- Parameters:
row- row from the table for which this map was prepared- Returns:
- cell value for the
semanticscolumn
-
getContentType
public java.lang.String getContentType(java.lang.Object[] row)
Returns the value of the DataLink content_type column in a given row.- Parameters:
row- row from the table for which this map was prepared- Returns:
- cell value for the
content_typecolumn
-
getContentLength
public java.lang.Long getContentLength(java.lang.Object[] row)
Returns the value of the DataLink content_length column in a given row.- Parameters:
row- row from the table for which this map was prepared- Returns:
- cell value for the
content_lengthcolumn, may be null
-
getValue
public <C> C getValue(LinkColMap.ColDef<C> col, java.lang.Object[] row)
Returns the typed corresponding to a given column definition in a given row.- Parameters:
col- column value extractor objectrow- row from the table for which this map was prepared- Returns:
- typed cell value for
col
-
getMap
public static LinkColMap getMap(uk.ac.starlink.table.StarTable table)
Constructs a LinkColMap that knows where the DataLink columns are in a supplied table. Columns are identified by name and content type. Incorrect UCDs etc lead to warnings emitted through the logging system. No check is made that all columns are present; attempts to retrieve column values for unidentified columns just return null.- Parameters:
table- table (assumed DataLink) to interpret- Returns:
- column map object
-
-