Package adql.db

Class DefaultDBColumn

java.lang.Object
adql.db.DBIdentifier
adql.db.DefaultDBColumn
All Implemented Interfaces:
DBColumn

public class DefaultDBColumn extends DBIdentifier implements DBColumn
Default implementation of DBColumn.

WARNING: constructors signature and behavior changed since v2.0! Before v2.0, the constructors expected to have the DB names before the ADQL names and thus, they forced to give a DB column name ; the ADQL column name being optional (if not provided it was set to the DB name). But since v2.0, this logic is inverted: the ADQL name is mandatory (a NullPointerException will be thrown if NULL or empty) while the DB name is optional (DBIdentifier.getDBName() will return the same as DBIdentifier.getADQLName() if no DB name is specified at initialization). Consequently, the ADQL names are expected as first parameters.

  • Field Details

    • 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.
  • Constructor Details

    • DefaultDBColumn

      public DefaultDBColumn(String adqlName, DBTable table) throws NullPointerException
      Builds a default DBColumn with the given ADQL name and table.

      With this constructor: DB name = ADQL name.

      Parameters:
      adqlName - The ADQL name of this column (i.e. name to use in ADQL).
      table - Table which contains this column.
      Throws:
      NullPointerException - If the given ADQL name is NULL or empty.
      Since:
      2.0
    • DefaultDBColumn

      public DefaultDBColumn(String adqlName, DBType type, DBTable table) throws NullPointerException
      Builds a default DBColumn with the given ADQL name and table.
      Parameters:
      adqlName - The ADQL name of this column (i.e. name to use in ADQL).
      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 - Table which contains this column.
      Throws:
      NullPointerException - If the given ADQL name is NULL or empty.
      Since:
      2.0
    • DefaultDBColumn

      public DefaultDBColumn(String adqlName, String dbName, DBTable table) throws NullPointerException
      Builds a default DBColumn with the given ADQL and DB names and table.
      Parameters:
      adqlName - The ADQL name of this column (i.e. name to use in ADQL).
      dbName - Database name. If NULL, DBIdentifier.getDBName() will return the same as DBIdentifier.getADQLName().
      table - Table which contains this column.
      Throws:
      NullPointerException - If the given ADQL name is NULL or empty.
      Since:
      2.0
    • DefaultDBColumn

      public DefaultDBColumn(String adqlName, String dbName, DBType type, DBTable table) throws NullPointerException
      Builds a default DBColumn with the given ADQL and DB names, type and table
      Parameters:
      adqlName - The ADQL name of this column (i.e. name to use in ADQL).
      dbName - Database name. If NULL, DBIdentifier.getDBName() will return the same as DBIdentifier.getADQLName().
      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 - Table which contains this column.
      Throws:
      NullPointerException - If the given ADQL name is NULL or empty.
      Since:
      2.0
  • Method Details

    • 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
    • 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(String dbName, 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.