Class ADQLColumn

java.lang.Object
adql.query.operand.ADQLColumn
All Implemented Interfaces:
ADQLObject, ADQLOperand, UnknownType

public class ADQLColumn extends Object implements ADQLOperand, UnknownType
Represents the complete (literal) reference to a column ({schema(s)}.{table}.{column}).
Version:
1.4 (03/2016)
Author:
Grégory Mantelet (CDS;ARI)
  • Constructor Details

    • ADQLColumn

      public ADQLColumn(String columnRef)
      Builds a Column with the complete reference to a column ({schema(s)}.{table}.{column}).
      Parameters:
      columnRef - The complete reference to a column.
      See Also:
    • ADQLColumn

      public ADQLColumn(String tableName, String columnName)
      Builds a column with the given column name and the given table name.
      Parameters:
      tableName - Name of the table.
      columnName - Name of the column.
      See Also:
    • ADQLColumn

      public ADQLColumn(String schema, String table, String column)
      Builds a column with the given column name, table name and schema name.
      Parameters:
      schema - Name of the schema.
      table - Name of the table.
      column - Name of the column.
      See Also:
    • ADQLColumn

      public ADQLColumn(String catalog, String schema, String table, String column)
      Builds a column with the given column name, table name, schema name and catalog name.
      Parameters:
      catalog - Name of the catalog.
      schema - Name of the schema.
      table - Name of the table.
      column - Name of the column.
      See Also:
    • ADQLColumn

      public ADQLColumn(ADQLColumn toCopy)
      Builds a Column by copying the given one.
      Parameters:
      toCopy - The Column to copy.
  • Method Details

    • normalizeName

      protected String normalizeName(String name, IdentifierField field)
      Lets normalizing any catalog/schema/table name or alias. If the name is surrounded by double-quotes, they are removed and the corresponding field will be declared as case sensitive.
      Parameters:
      name - Name to normalize.
      Returns:
      The normalized name.
    • getPosition

      public final TextPosition getPosition()
      Description copied from interface: ADQLObject

      Gets the position of this object/token in the ADQL query.

      By default, no position should be set.

      Specified by:
      getPosition in interface ADQLObject
      Returns:
      Position of this ADQL item in the ADQL query, or NULL if not written originally in the query (for example, if added afterwards.
    • setPosition

      public void setPosition(TextPosition pos)
      Sets the position at which this ADQLColumn has been found in the original ADQL query string.
      Parameters:
      pos - Position of this ADQLColumn.
    • getCatalogName

      public final String getCatalogName()
      Gets the name of the catalog which contains this column.
      Returns:
      Catalog name.
    • setCatalogName

      public final void setCatalogName(String catalog)
      Sets the name of the catalog which contains this column.
      Parameters:
      catalog - New name of the catalog.
    • getSchemaName

      public final String getSchemaName()
      Gets the name of the schema which contains this column.
      Returns:
      Schema name.
    • setSchemaName

      public final void setSchemaName(String schema)
      Sets the name of the schema which contains this column.
      Parameters:
      schema - New name of the schema.
    • getTableName

      public final String getTableName()
      Gets the name of the table which contains this column.
      Returns:
      Table name.
    • setTableName

      public final void setTableName(String tableName)
      Sets the name of the table which contains this column.
      Parameters:
      tableName - New name of the table.
    • getColumnName

      public final String getColumnName()
      Gets the name of this column.
      Returns:
      Its column name.
    • getFullColumnName

      public final String getFullColumnName()
      Gets the full name of this column (catalogName . schemaName . tableName . columnName) by respecting the case sensitivity of each field (if case sensitive, double-quotes will surround the concerned fields name).
      Returns:
      Its full name.
      See Also:
    • getFullColumnPrefix

      public final StringBuffer getFullColumnPrefix()
      Gets the full column prefix (catalogName . schemaName . tableName) by respecting the case sensitivity of each field (if case sensitive, double-quotes will surround the concerned fields name).
      Returns:
      Its full prefix.
    • setColumnName

      public final void setColumnName(String columnName)
      Changes the name of the column ({column} in {schema(s)}.{table}.{column}).
      Parameters:
      columnName - The new column name.
    • setColumn

      public final void setColumn(String columnRef)
      Updates the whole Column according to the given column reference ({catalog}.{schema}.{table}.{column}).
      Parameters:
      columnRef - The complete column reference ({catalog}.{schema}.{table}.{column}).
    • isCaseSensitive

      public final boolean isCaseSensitive(IdentifierField field)
      Indicates whether the specified field (catalog, schema, table or column) is case sensitive or not.
      Parameters:
      field - A field (catalog, schema, table or column).
      Returns:
      true if the specified field is case sensitive, false otherwise.
      See Also:
    • setCaseSensitive

      public final void setCaseSensitive(IdentifierField field, boolean sensitive)
      Sets the case sensitivity of the specified field (catalog, schema, table, column).
      Parameters:
      field - The field for which the case sensitivity must be updated.
      sensitive - true if the specified field must be case sensitive, false otherwise.
      See Also:
    • isCaseSensitive

      public final boolean isCaseSensitive()
      Indicates whether all fields (catalog, schema, table and column) are case sensitive.
      Returns:
      true if all fields are case sensitive, false otherwise.
      See Also:
    • setCaseSensitive

      public final void setCaseSensitive(boolean sensitive)
      Sets the case sensitivity of all fields (catalog, schema, table and column).
      Parameters:
      sensitive - true if all fields must be case sensitive, false otherwise.
      See Also:
    • getCaseSensitive

      public final byte getCaseSensitive()
      Gets the whole case sensitivity of this ADQL column.
      Returns:
      Its new case sensitivity (one bit per fields).
      See Also:
    • setCaseSensitive

      public final void setCaseSensitive(byte sensitivity)
      Sets the whole case sensitivity of this ADQL column.
      Parameters:
      sensitivity - Its new case sensitivity (one bit per fields).
      See Also:
    • getDBLink

      public final DBColumn getDBLink()
      Gets the corresponding DBColumn.
      Returns:
      The corresponding DBColumn.
    • setDBLink

      public final void setDBLink(DBColumn dbLink)

      Sets the DBColumn corresponding to this ADQLColumn.

      By default, this field is automatically filled by DBChecker.

      Parameters:
      dbLink - Its corresponding DBColumn.
    • getAdqlTable

      public final ADQLTable getAdqlTable()
      Gets the ADQLTable from which this column is supposed to come.
      Returns:
      Its source table.
    • setAdqlTable

      public final void setAdqlTable(ADQLTable adqlTable)

      Sets the ADQLTable from which this column is supposed to come.

      By default, this field is automatically filled by DBChecker when DBChecker.check(adql.query.ADQLQuery) is called.

      Parameters:
      adqlTable - Its source table.
    • getExpectedType

      public char getExpectedType()
      Description copied from interface: UnknownType
      Get the type expected by the syntactic parser according to the context.
      Specified by:
      getExpectedType in interface UnknownType
      Returns:
      Expected type: 'n' or 'N' for numeric, 's' or 'S' for string, 'g' or 'G' for geometry.
    • setExpectedType

      public void setExpectedType(char c)
      Description copied from interface: UnknownType
      Set the type expected for this operand.
      Specified by:
      setExpectedType in interface UnknownType
      Parameters:
      c - Expected type: 'n' or 'N' for numeric, 's' or 'S' for string, 'g' or 'G' for geometry.
    • isNumeric

      public boolean isNumeric()
      Description copied from interface: ADQLOperand
      Tell whether this operand is numeric or not.
      Specified by:
      isNumeric in interface ADQLOperand
      Returns:
      true if this operand is numeric, false otherwise.
    • isString

      public boolean isString()
      Description copied from interface: ADQLOperand
      Tell whether this operand is a string or not.
      Specified by:
      isString in interface ADQLOperand
      Returns:
      true if this operand is a string, false otherwise.
    • isGeometry

      public boolean isGeometry()
      Description copied from interface: ADQLOperand
      Tell whether this operand is a geometrical region or not.
      Specified by:
      isGeometry in interface ADQLOperand
      Returns:
      true if this operand is a geometry, false otherwise.
    • getCopy

      public ADQLObject getCopy() throws Exception
      Description copied from interface: ADQLObject
      Gets a (deep) copy of this ADQL object.
      Specified by:
      getCopy in interface ADQLObject
      Returns:
      The copy of this ADQL object.
      Throws:
      Exception - If there is any error during the copy.
    • getName

      public String getName()
      Description copied from interface: ADQLObject
      Gets the name of this object in ADQL.
      Specified by:
      getName in interface ADQLObject
      Returns:
      The name of this ADQL object.
    • adqlIterator

      public ADQLIterator adqlIterator()
      Description copied from interface: ADQLObject

      Gets an iterator on the intern ADQL objects.

      Note:The returned iterator is particularly used by a ISearchHandler extension to browse a whole ADQL tree.

      Specified by:
      adqlIterator in interface ADQLObject
      Returns:
      An ADQL objects iterator.
      See Also:
    • toADQL

      public String toADQL()
      Description copied from interface: ADQLObject
      Gets the ADQL expression of this object.
      Specified by:
      toADQL in interface ADQLObject
      Returns:
      The corresponding ADQL expression.
    • toString

      public String toString()
      Overrides:
      toString in class Object