Package adql.query

Class WithItem

java.lang.Object
adql.query.WithItem
All Implemented Interfaces:
ADQLObject

public class WithItem extends Object implements ADQLObject
Object representation of the definition of a Common Table Expression (CTE).

A such table is defined inside the ADQL clause WITH. It must be an ADQL query with a name for the resulting temporary table. Labels of the resulting columns may be also provided.

Since:
2.0
  • Field Details

    • FEATURE

      public static final LanguageFeature FEATURE
      Description of this ADQL Feature.
    • label

      protected String label
      Name of the resulting table.
    • caseSensitive

      protected boolean caseSensitive
      Flag indicating whether the table name is case sensitive or not.
    • query

      protected ADQLSet query
      ADQL query providing the CTE's content.
    • position

      protected TextPosition position
      Position of this WITH item in the original ADQL query.
  • Constructor Details

    • WithItem

      public WithItem(String label, ADQLSet query)
      Create a WITH item.
      Parameters:
      label - Name of the resulting table/CTE.
      query - ADQL query returning the content of this CTE.
    • WithItem

      public WithItem(WithItem toCopy)
      Create a deep copy of the given WITH item.
      Parameters:
      toCopy - The WITH item to duplicate.
  • Method Details

    • getName

      public final 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.
    • getFeatureDescription

      public final LanguageFeature getFeatureDescription()
      Description copied from interface: ADQLObject
      Get the description of this ADQL's Language Feature.

      Note: Getting this description is generally only useful when discovery optional features so that determining if they are allowed to be used in ADQL queries.

      Specified by:
      getFeatureDescription in interface ADQLObject
      Returns:
      Description of this ADQL object as an ADQL's feature.
    • getLabel

      public final String getLabel()
      Get the name of the resulting table.
      Returns:
      CTE's name.
    • setLabel

      public final void setLabel(String label) throws NullPointerException
      Set the name of the resulting table.

      Note: The given name may be delimited (i.e. surrounded by double quotes). If so, it will be considered as case sensitive. Surrounding double quotes will be removed and inner escaped double quotes will be un-escaped.

      Parameters:
      label - New CTE's name.
      Throws:
      NullPointerException - If the given name is NULL or empty.
    • isLabelCaseSensitive

      public final boolean isLabelCaseSensitive()
      Tell whether the resulting table name is case sensitive or not.
      Returns:
      true if the CTE's name is case sensitive, false otherwise.
    • setLabelCaseSensitive

      public final void setLabelCaseSensitive(boolean caseSensitive)
      Specify whether the resulting table name should be case sensitive or not.
      Parameters:
      caseSensitive - true to make the CTE's name case sensitive, false otherwise.
    • getQuery

      public final ADQLSet getQuery()
      Get the query corresponding to this CTE.
      Returns:
      CTE's query.
    • setQuery

      public final void setQuery(ADQLSet query)
      Set the query returning the content of this CTE.
      Parameters:
      query - New CTE's query.
    • getDBLink

      public final DBTable getDBLink()
      Database description of this CTE.
      Returns:
      CTE's metadata.
    • setDBLink

      public final void setDBLink(DBTable dbMeta)
      Set the database description of this CTE.
      Parameters:
      dbMeta - The new CTE's metadata.
    • 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 final void setPosition(TextPosition newPosition)
    • 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.
    • 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.
    • getResultingColumns

      public DBColumn[] getResultingColumns()
      Get the description of all output columns.
      Returns:
      List and description of all output columns.