public class TAPColumn extends java.lang.Object implements DBColumn
Represent a column as described by the IVOA standard in the TAP protocol definition.
This object representation has exactly the same fields as the column of the table TAP_SCHEMA.columns.
But it also provides a way to add other data. For instance, if information not listed in the standard
may be stored here, they can be using the function setOtherData(Object)
. This object can be
a single value (integer, string, ...), but also a Map
, List
, etc...
Important note:
A TAPColumn
object MUST always have a DB name. That's why, getDBName()
returns
what getADQLName()
returns when no DB name is set. After creation, it is possible to set
the DB name with setDBName(String)
.
This DB name MUST be UNqualified and without double quotes. If a NULL or empty value is provided,
getDBName()
returns what getADQLName()
returns.
By default a column is detached (not part of a table). To specify the table in which this column is,
you must use TAPTable.addColumn(TAPColumn)
. By doing this, the table link inside this column
will be set automatically and you will be able to get the table with getTable()
.
In case this column is linked to one or several of other tables, it will be possible to list all
foreign keys where the target columns is with getTargets()
. In the same way, it will be
possible to list all foreign keys in which this column is a target with getSources()
.
However, in order to ensure the consistency between all metadata, these foreign key's links are
set at the table level by the table itself using addSource(TAPForeignKey)
and
addTarget(TAPForeignKey)
.
Modifier and Type | Field and Description |
---|---|
protected java.util.ArrayList<TAPForeignKey> |
lstSources
List all foreign keys in which this column is a target.
|
protected java.util.ArrayList<TAPForeignKey> |
lstTargets
List all foreign keys in which this column is a source.
|
protected java.lang.Object |
otherData
Let add some information in addition of the ones of the TAP protocol.
|
Constructor and Description |
---|
TAPColumn(java.lang.String columnName)
Build a VARCHAR
TAPColumn instance with the given ADQL name. |
TAPColumn(java.lang.String columnName,
DBType type)
Build a
TAPColumn instance with the given ADQL name and datatype. |
TAPColumn(java.lang.String columnName,
DBType type,
java.lang.String description)
Build a
TAPColumn instance with the given ADQL name, datatype and description. |
TAPColumn(java.lang.String columnName,
DBType type,
java.lang.String description,
java.lang.String unit)
Build a
TAPColumn instance with the given ADQL name, type, description and unit. |
TAPColumn(java.lang.String columnName,
DBType type,
java.lang.String description,
java.lang.String unit,
java.lang.String ucd,
java.lang.String utype)
Build a
TAPColumn instance with the given fields. |
TAPColumn(java.lang.String columnName,
java.lang.String description)
Build a VARCHAR
TAPColumn instance with the given ADQL name and description. |
TAPColumn(java.lang.String columnName,
java.lang.String description,
java.lang.String unit)
Build a VARCHAR
TAPColumn instance with the given ADQL name, description and unit. |
TAPColumn(java.lang.String columnName,
java.lang.String description,
java.lang.String unit,
java.lang.String ucd,
java.lang.String utype)
Build a VARCHAR
TAPColumn instance with the given fields. |
Modifier and Type | Method and Description |
---|---|
protected void |
addSource(TAPForeignKey key)
Let add a foreign key in which this column is a target (= which is targeted by another column).
|
protected void |
addTarget(TAPForeignKey key)
Let add a foreign key in which this column is a source (= which is targeting another column).
|
DBColumn |
copy()
Provide a deep copy (included the other data) of this column.
|
DBColumn |
copy(java.lang.String dbName,
java.lang.String adqlName,
DBTable dbTable)
Warning:
Since the type of the other data is not known, the copy of its value
can not be done properly.
|
boolean |
equals(java.lang.Object obj) |
java.lang.String |
getADQLName()
Gets the name of this column (without any prefix and double-quotes).
|
TAPCoosys |
getCoosys()
Get the used coordinate system.
|
DBType |
getDatatype()
Get the type of the column's values.
|
java.lang.String |
getDBName()
Gets the name of this column in the "database".
|
java.lang.String |
getDescription()
Get the description of this column.
|
int |
getIndex()
Get the ordering index of this column inside its table.
|
java.lang.String |
getName()
Deprecated.
Does not do anything special: just call
getADQLName() . |
int |
getNbSources()
Get the number of times this column is targeted by another column.
|
int |
getNbTargets()
Get the number of times this column is targeting another column.
|
java.lang.Object |
getOtherData()
Get the other (piece of) information associated with this column.
|
java.lang.String |
getRawName()
Get the full ADQL name of this table, as it has been provided at initialization.
|
java.util.Iterator<TAPForeignKey> |
getSources()
Get the list of foreign keys in which this column is a target (= is targeted another column).
|
DBTable |
getTable()
Gets the table which contains this
DBColumn . |
java.util.Iterator<TAPForeignKey> |
getTargets()
Get the list of foreign keys in which this column is a source (= is targeting another column).
|
java.lang.String |
getUcd()
Get the UCD describing the scientific content of this column.
|
java.lang.String |
getUnit()
Get the unit of the column's values.
|
java.lang.String |
getUtype()
Get the UType associating this column with a data-model.
|
boolean |
isIndexed()
Tell whether this column is indexed.
|
boolean |
isNullable()
Tell whether this column is nullable.
|
boolean |
isPrincipal()
Tell whether this column is one of those returned by default.
|
boolean |
isStd()
Tell whether this column is defined by a standard.
|
protected void |
removeAllSources()
Remove the fact that this column is a target (= is targeted by another column)
in any foreign key in which it was.
|
protected void |
removeAllTargets()
Remove the fact that this column is a source (= is targeting another column)
in any foreign key in which it was.
|
protected void |
removeSource(TAPForeignKey key)
Remove the fact that this column is a target (= is targeted by another column)
in the given foreign key.
|
protected void |
removeTarget(TAPForeignKey key)
Remove the fact that this column is a source (= is targeting another column)
in the given foreign key.
|
void |
setCoosys(TAPCoosys newCoosys)
Set the the coordinate system to use.
|
void |
setDatatype(DBType type)
Set the type of the column's values.
|
void |
setDBName(java.lang.String name)
Change the name that this column MUST have in the database (i.e.
|
void |
setDescription(java.lang.String description)
Set the description of this column.
|
void |
setIndex(int columnIndex)
Set the ordering index of this column inside its table.
|
void |
setIndexed(boolean indexed)
Set whether this column is indexed or not.
|
void |
setNullable(boolean nullable)
Set whether this column is nullable or not.
|
void |
setOtherData(java.lang.Object data)
Set the other (piece of) information associated with this column.
|
void |
setPrincipal(boolean principal)
Set whether this column should be one of those returned by default.
|
void |
setStd(boolean std)
Set whether this column is defined by a standard.
|
protected void |
setTable(DBTable table)
Set the table in which this column is.
|
void |
setUcd(java.lang.String ucd)
Set the UCD describing the scientific content of this column.
|
void |
setUnit(java.lang.String unit)
Set the unit of the column's values.
|
void |
setUtype(java.lang.String utype)
Set the UType associating this column with a data-model.
|
java.lang.String |
toString() |
protected java.lang.Object otherData
Integer
, a String
, a Map
, a List
, ...
Its content is totally free and never used or checked.protected final java.util.ArrayList<TAPForeignKey> lstTargets
CAUTION: For consistency consideration, this attribute SHOULD never be modified! It is set by the constructor and filled ONLY by the table.
protected final java.util.ArrayList<TAPForeignKey> lstSources
CAUTION: For consistency consideration, this attribute SHOULD never be modified! It is set by the constructor and filled ONLY by the table.
public TAPColumn(java.lang.String columnName) throws java.lang.NullPointerException
Build a VARCHAR TAPColumn
instance with the given ADQL name.
Note 1:
The DB name is set by default to NULL so that getDBName()
returns exactly what getADQLName()
returns.
To set a specific DB name, you MUST call setDBName(String)
.
Note 2: The datatype is set by default to VARCHAR.
Important notes on the given ADQL name:
getADQLName()
but will be still here when using getRawName()
. To work, the table name must be exactly the same
as what the function TAPTable.getRawName()
of the set table returns.
getADQLName()
but will
still appear in the result of getRawName()
.
columnName
- Name that this column MUST have in ADQL queries.
CAN'T be NULL ; this name can never be changed after initialization.java.lang.NullPointerException
- If the given name is null
,
or if the given string is empty after simplification
(i.e. without the surrounding double quotes).public TAPColumn(java.lang.String columnName, DBType type) throws java.lang.NullPointerException
Build a TAPColumn
instance with the given ADQL name and datatype.
Note 1:
The DB name is set by default to NULL so that getDBName()
returns exactly what getADQLName()
returns.
To set a specific DB name, you MUST call setDBName(String)
.
Note 2: The datatype is set by default to VARCHAR.
Important notes on the given ADQL name:
getADQLName()
but will be still here when using getRawName()
. To work, the table name must be exactly the same
as what the function TAPTable.getRawName()
of the set table returns.
getADQLName()
but will
still appear in the result of getRawName()
.
columnName
- Name that this column MUST have in ADQL queries.
CAN'T be NULL ; this name can never be changed after initialization.type
- Datatype of this column. If NULL, VARCHAR will be the datatype of this columnjava.lang.NullPointerException
- If the given name is null
,
or if the given string is empty after simplification
(i.e. without the surrounding double quotes).setDatatype(DBType)
public TAPColumn(java.lang.String columnName, java.lang.String description) throws java.lang.NullPointerException
Build a VARCHAR TAPColumn
instance with the given ADQL name and description.
Note 1:
The DB name is set by default to NULL so that getDBName()
returns exactly what getADQLName()
returns.
To set a specific DB name, you MUST call setDBName(String)
.
Note 2: The datatype is set by default to VARCHAR.
Important notes on the given ADQL name:
getADQLName()
but will be still here when using getRawName()
. To work, the table name must be exactly the same
as what the function TAPTable.getRawName()
of the set table returns.
getADQLName()
but will
still appear in the result of getRawName()
.
columnName
- Name that this column MUST have in ADQL queries.
CAN'T be NULL ; this name can never be changed after initialization.description
- Description of the column's content. May be NULLjava.lang.NullPointerException
- If the given name is null
,
or if the given string is empty after simplification
(i.e. without the surrounding double quotes).public TAPColumn(java.lang.String columnName, DBType type, java.lang.String description) throws java.lang.NullPointerException
Build a TAPColumn
instance with the given ADQL name, datatype and description.
Note 1:
The DB name is set by default to NULL so that getDBName()
returns exactly what getADQLName()
returns.
To set a specific DB name, you MUST call setDBName(String)
.
Note 2:
The datatype is set by calling the function setDatatype(DBType)
which does not do
anything if the given datatype is NULL.
Important notes on the given ADQL name:
getADQLName()
but will be still here when using getRawName()
. To work, the table name must be exactly the same
as what the function TAPTable.getRawName()
of the set table returns.
getADQLName()
but will
still appear in the result of getRawName()
.
columnName
- Name that this column MUST have in ADQL queries.
CAN'T be NULL ; this name can never be changed after initialization.type
- Datatype of this column. If NULL, VARCHAR will be the datatype of this columndescription
- Description of the column's content. May be NULLjava.lang.NullPointerException
- If the given name is null
,
or if the given string is empty after simplification
(i.e. without the surrounding double quotes).public TAPColumn(java.lang.String columnName, java.lang.String description, java.lang.String unit) throws java.lang.NullPointerException
Build a VARCHAR TAPColumn
instance with the given ADQL name, description and unit.
Note 1:
The DB name is set by default to NULL so that getDBName()
returns exactly what getADQLName()
returns.
To set a specific DB name, you MUST call setDBName(String)
.
Note 2: The datatype is set by default to VARCHAR.
Important notes on the given ADQL name:
getADQLName()
but will be still here when using getRawName()
. To work, the table name must be exactly the same
as what the function TAPTable.getRawName()
of the set table returns.
getADQLName()
but will
still appear in the result of getRawName()
.
columnName
- Name that this column MUST have in ADQL queries.
CAN'T be NULL ; this name can never be changed after initialization.description
- Description of the column's content. May be NULLunit
- Unit of the column's values. May be NULLjava.lang.NullPointerException
- If the given name is null
,
or if the given string is empty after simplification
(i.e. without the surrounding double quotes).public TAPColumn(java.lang.String columnName, DBType type, java.lang.String description, java.lang.String unit) throws java.lang.NullPointerException
Build a TAPColumn
instance with the given ADQL name, type, description and unit.
Note 1:
The DB name is set by default to NULL so that getDBName()
returns exactly what getADQLName()
returns.
To set a specific DB name, you MUST call setDBName(String)
.
Note 2:
The datatype is set by calling the function setDatatype(DBType)
which does not do
anything if the given datatype is NULL.
Important notes on the given ADQL name:
getADQLName()
but will be still here when using getRawName()
. To work, the table name must be exactly the same
as what the function TAPTable.getRawName()
of the set table returns.
getADQLName()
but will
still appear in the result of getRawName()
.
columnName
- Name that this column MUST have in ADQL queries.
CAN'T be NULL ; this name can never be changed after initialization.type
- Datatype of this column. If NULL, VARCHAR will be the datatype of this columndescription
- Description of the column's content. May be NULLunit
- Unit of the column's values. May be NULLjava.lang.NullPointerException
- If the given name is null
,
or if the given string is empty after simplification
(i.e. without the surrounding double quotes).public TAPColumn(java.lang.String columnName, java.lang.String description, java.lang.String unit, java.lang.String ucd, java.lang.String utype) throws java.lang.NullPointerException
Build a VARCHAR TAPColumn
instance with the given fields.
Note 1:
The DB name is set by default to NULL so that getDBName()
returns exactly what getADQLName()
returns.
To set a specific DB name, you MUST call setDBName(String)
.
Note 2: The datatype is set by default to VARCHAR.
Important notes on the given ADQL name:
getADQLName()
but will be still here when using getRawName()
. To work, the table name must be exactly the same
as what the function TAPTable.getRawName()
of the set table returns.
getADQLName()
but will
still appear in the result of getRawName()
.
columnName
- Name that this column MUST have in ADQL queries.
CAN'T be NULL ; this name can never be changed after initialization.description
- Description of the column's content. May be NULLunit
- Unit of the column's values. May be NULLucd
- UCD describing the scientific content of this column.utype
- UType associating this column with a data-model.java.lang.NullPointerException
- If the given name is null
,
or if the given string is empty after simplification
(i.e. without the surrounding double quotes).public TAPColumn(java.lang.String columnName, DBType type, java.lang.String description, java.lang.String unit, java.lang.String ucd, java.lang.String utype) throws java.lang.NullPointerException
Build a TAPColumn
instance with the given fields.
Note 1:
The DB name is set by default to NULL so that getDBName()
returns exactly what getADQLName()
returns.
To set a specific DB name, you MUST call setDBName(String)
.
Note 2:
The datatype is set by calling the function setDatatype(DBType)
which does not do
anything if the given datatype is NULL.
Important notes on the given ADQL name:
getADQLName()
but will be still here when using getRawName()
. To work, the table name must be exactly the same
as what the function TAPTable.getRawName()
of the set table returns.
getADQLName()
but will
still appear in the result of getRawName()
.
columnName
- Name that this column MUST have in ADQL queries.
CAN'T be NULL ; this name can never be changed after initialization.type
- Datatype of this column. If NULL, VARCHAR will be the datatype of this columndescription
- Description of the column's content. May be NULLunit
- Unit of the column's values. May be NULLucd
- UCD describing the scientific content of this column.utype
- UType associating this column with a data-model.java.lang.NullPointerException
- If the given name is null
,
or if the given string is empty after simplification
(i.e. without the surrounding double quotes).@Deprecated public final java.lang.String getName()
getADQLName()
.getADQLName()
public final java.lang.String getADQLName()
DBColumn
getADQLName
in interface DBColumn
public final java.lang.String getRawName()
public final java.lang.String getDBName()
DBColumn
public final void setDBName(java.lang.String name)
Change the name that this column MUST have in the database (i.e. in SQL queries).
Note: If the given value is NULL or an empty string, nothing is done ; the DB name keeps is former value.
name
- The new database name of this column.public final DBTable getTable()
DBColumn
DBColumn
.protected final void setTable(DBTable table)
Set the table in which this column is.
Warning:
For consistency reasons, this function SHOULD be called only by the TAPTable
that owns this column.
Important note:
If this column was already linked with another TAPTable
object, the previous link is removed
here, but also in the table (by calling TAPTable.removeColumn(String)
).
table
- The table that owns this column.public final java.lang.String getDescription()
public final void setDescription(java.lang.String description)
description
- Its new description. MAY be NULLpublic final java.lang.String getUnit()
public final void setUnit(java.lang.String unit)
unit
- Its new unit. MAY be NULLpublic final java.lang.String getUcd()
public final void setUcd(java.lang.String ucd)
ucd
- Its new UCD. MAY be NULLpublic final java.lang.String getUtype()
public final void setUtype(java.lang.String utype)
utype
- Its new UType. MAY be NULLpublic final DBType getDatatype()
getDatatype
in interface DBColumn
public final void setDatatype(DBType type)
Set the type of the column's values.
Note:
If the given type is NULL, an UNKNOWN
type will be set instead.
type
- Its new datatype.public final boolean isPrincipal()
public final void setPrincipal(boolean principal)
principal
- true if this column should be returned by default, false otherwise.public final boolean isIndexed()
public final void setIndexed(boolean indexed)
indexed
- true if this column is indexed, false otherwise.public final boolean isNullable()
public final void setNullable(boolean nullable)
nullable
- true if this column is nullable, false otherwise.public final boolean isStd()
public final void setStd(boolean std)
std
- true if this column is defined by a standard, false otherwise.public final int getIndex()
public final void setIndex(int columnIndex)
columnIndex
- Its new ordering index.public final TAPCoosys getCoosys()
public final void setCoosys(TAPCoosys newCoosys)
newCoosys
- Its new coordinate system.public java.lang.Object getOtherData()
Get the other (piece of) information associated with this column.
Note:
By default, NULL is returned, but it may be any kind of value (Integer
,
String
, Map
, List
, ...).
public void setOtherData(java.lang.Object data)
data
- Another information about this column. MAY be NULLprotected void addTarget(TAPForeignKey key)
Let add a foreign key in which this column is a source (= which is targeting another column).
Note: Nothing is done if the given value is NULL.
Warning:
For consistency reasons, this function SHOULD be called only by the TAPTable
that owns this column or that is part of the foreign key.
key
- A foreign key.public int getNbTargets()
public java.util.Iterator<TAPForeignKey> getTargets()
protected void removeTarget(TAPForeignKey key)
Remove the fact that this column is a source (= is targeting another column) in the given foreign key.
Note: Nothing is done if the given value is NULL.
Warning:
For consistency reasons, this function SHOULD be called only by the TAPTable
that owns this column or that is part of the foreign key.
key
- Foreign key in which this column was targeting another column.protected void removeAllTargets()
Remove the fact that this column is a source (= is targeting another column) in any foreign key in which it was.
Warning:
For consistency reasons, this function SHOULD be called only by the TAPTable
that owns this column or that is part of the foreign key.
protected void addSource(TAPForeignKey key)
Let add a foreign key in which this column is a target (= which is targeted by another column).
Note: Nothing is done if the given value is NULL.
Warning:
For consistency reasons, this function SHOULD be called only by the TAPTable
that owns this column or that is part of the foreign key.
key
- A foreign key.public int getNbSources()
public java.util.Iterator<TAPForeignKey> getSources()
protected void removeSource(TAPForeignKey key)
Remove the fact that this column is a target (= is targeted by another column) in the given foreign key.
Note: Nothing is done if the given value is NULL.
Warning:
For consistency reasons, this function SHOULD be called only by the TAPTable
that owns this column or that is part of the foreign key.
key
- Foreign key in which this column was targeted by another column.protected void removeAllSources()
Remove the fact that this column is a target (= is targeted by another column) in any foreign key in which it was.
Warning:
For consistency reasons, this function SHOULD be called only by the TAPTable
that owns this column or that is part of the foreign key.
public DBColumn copy(java.lang.String dbName, java.lang.String adqlName, DBTable dbTable)
Warning: Since the type of the other data is not known, the copy of its value can not be done properly. So, this column and its copy will share the same other data object. If it is also needed to make a deep copy of this other data object, this function MUST be overridden.
copy
in interface DBColumn
dbName
- Its new DB name.adqlName
- Its new ADQL name.dbTable
- Its new table.DBColumn
.DBColumn.copy(java.lang.String, java.lang.String, adql.db.DBTable)
public DBColumn copy()
Provide a deep copy (included the other data) of this column.
Warning: Since the type of the other data is not known, the copy of its value can not be done properly. So, this column and its copy will share the same other data object. If it is also needed to make a deep copy of this other data object, this function MUST be overridden.
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object