Package adql.db

Class DefaultDBColumn

  • All Implemented Interfaces:
    DBColumn

    public class DefaultDBColumn
    extends java.lang.Object
    implements DBColumn
    Default implementation of DBColumn.
    Version:
    1.4 (08/2015)
    Author:
    Grégory Mantelet (CDS;ARI)
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.String adqlName
      Name that this column must have in ADQL queries.
      protected java.lang.String dbName
      Name of the column in the "database".
      protected DBTable table
      Table in which this column exists.
      protected DBType type
      Type of the column in the "database".
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      DBColumn copy​(java.lang.String dbName, java.lang.String adqlName, DBTable dbTable)
      Makes a copy of this instance of DBColumn.
      java.lang.String getADQLName()
      Gets the name of this column (without any prefix and double-quotes).
      DBType getDatatype()
      Get the type of this column (as closed as possible from the "database" type).
      java.lang.String getDBName()
      Gets the name of this column in the "database".
      DBTable getTable()
      Gets the table which contains this DBColumn.
      void setADQLName​(java.lang.String adqlName)  
      void setDatatype​(DBType type)
      Set the type of this column.
      void setTable​(DBTable table)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • dbName

        protected java.lang.String dbName
        Name of the column in the "database".
      • type

        protected DBType type
        Type of the column in the "database". Note: This should be one of the types listed by the IVOA in the TAP description.
        Since:
        1.3
      • table

        protected DBTable table
        Table in which this column exists.
      • adqlName

        protected java.lang.String adqlName
        Name that this column must have in ADQL queries.
    • Constructor Detail

      • DefaultDBColumn

        public DefaultDBColumn​(java.lang.String dbName,
                               DBTable table)
        Builds a default DBColumn with the given DB name and DB table.
        Parameters:
        dbName - Database column name (it will be also used for the ADQL name). Only the column name is expected. Contrary to DefaultDBTable, if a whole column reference is given, no split will be done.
        table - DB table which contains this column.
        See Also:
        DefaultDBColumn(String, String, DBType, DBTable)
      • DefaultDBColumn

        public DefaultDBColumn​(java.lang.String dbName,
                               DBType type,
                               DBTable table)
        Builds a default DBColumn with the given DB name and DB table.
        Parameters:
        dbName - Database column name (it will be also used for the ADQL name). Only the column name is expected. Contrary to DefaultDBTable, if a whole column reference is given, no split will be done.
        type - Type of the column. Note: there is no default value. Consequently if this parameter is NULL, the type should be considered as unknown. It means that any comparison with any type will always return 'true'.
        table - DB table which contains this column.
        Since:
        1.3
        See Also:
        DefaultDBColumn(String, String, DBType, DBTable)
      • DefaultDBColumn

        public DefaultDBColumn​(java.lang.String dbName,
                               java.lang.String adqlName,
                               DBTable table)
        Builds a default DBColumn with the given DB name, DB table and ADQL name.
        Parameters:
        dbName - Database column name. Only the column name is expected. Contrary to DefaultDBTable, if a whole column reference is given, no split will be done.
        adqlName - Column name used in ADQL queries. Only the column name is expected. Contrary to DefaultDBTable, if a whole column reference is given, no split will be done.
        table - DB table which contains this column.
        See Also:
        DefaultDBColumn(String, String, DBType, DBTable)
      • DefaultDBColumn

        public DefaultDBColumn​(java.lang.String dbName,
                               java.lang.String adqlName,
                               DBType type,
                               DBTable table)
        Builds a default DBColumn with the given DB name, DB table and ADQL name.
        Parameters:
        dbName - Database column name. Only the column name is expected. Contrary to DefaultDBTable, if a whole column reference is given, no split will be done. REQUIRED parameter: it must be not NULL.
        adqlName - Column name used in ADQL queries. Only the column name is expected. Contrary to DefaultDBTable, if a whole column reference is given, no split will be done. If NULL, it will be set to dbName.
        type - Type of the column. Note: there is no default value. Consequently if this parameter is NULL, the type should be considered as unknown. It means that any comparison with any type will always return 'true'.
        table - DB table which contains this column.
        Since:
        1.3
    • Method Detail

      • getADQLName

        public final java.lang.String getADQLName()
        Description copied from interface: DBColumn
        Gets the name of this column (without any prefix and double-quotes).
        Specified by:
        getADQLName in interface DBColumn
        Returns:
        Its ADQL name.
      • setADQLName

        public final void setADQLName​(java.lang.String adqlName)
      • getDatatype

        public final DBType getDatatype()
        Description copied from interface: DBColumn

        Get the type of this column (as closed as possible from the "database" type).

        Note: The returned type should be as closed as possible from a type listed by the IVOA in the TAP protocol description into the section UPLOAD.

        Specified by:
        getDatatype in interface DBColumn
        Returns:
        Its type.
      • setDatatype

        public final void setDatatype​(DBType type)

        Set the type of this column.

        Note 1: The given type should be as closed as possible from a type listed by the IVOA in the TAP protocol description into the section UPLOAD.

        Note 2: there is no default value. Consequently if this parameter is NULL, the type should be considered as unknown. It means that any comparison with any type will always return 'true'.

        Parameters:
        type - New type of this column.
        Since:
        1.3
      • getDBName

        public final java.lang.String getDBName()
        Description copied from interface: DBColumn
        Gets the name of this column in the "database".
        Specified by:
        getDBName in interface DBColumn
        Returns:
        Its DB name.
      • getTable

        public final DBTable getTable()
        Description copied from interface: DBColumn
        Gets the table which contains this DBColumn.
        Specified by:
        getTable in interface DBColumn
        Returns:
        Its table or null if no table is specified.
      • setTable

        public final void setTable​(DBTable table)
      • copy

        public DBColumn copy​(java.lang.String dbName,
                             java.lang.String adqlName,
                             DBTable dbTable)
        Description copied from interface: DBColumn
        Makes a copy of this instance of DBColumn.
        Specified by:
        copy in interface DBColumn
        Parameters:
        dbName - Its new DB name.
        adqlName - Its new ADQL name.
        dbTable - Its new table.
        Returns:
        A modified copy of this DBColumn.