Package adql.query

Class ADQLQuery

java.lang.Object
adql.query.ADQLSet
adql.query.ADQLQuery
All Implemented Interfaces:
ADQLObject

public class ADQLQuery extends ADQLSet
Object representation of an ADQL query or sub-query.

The resulting object of the ADQLParser is an object of this class if no set operation is performed.

  • Field Details

    • FEATURE

      public static final LanguageFeature FEATURE
      Description of this ADQL Feature.
      Since:
      2.0
  • Constructor Details

    • ADQLQuery

      public ADQLQuery()
      Builds an empty ADQL query.
    • ADQLQuery

      public ADQLQuery(ADQLParser.ADQLVersion version)
      Builds an empty ADQL query following the specified ADQL grammar.
      Parameters:
      version - Followed version of the ADQL grammar. If NULL, the
      invalid reference
      default version
      will be set.
      Since:
      2.0
    • ADQLQuery

      public ADQLQuery(ADQLQuery toCopy) throws Exception
      Builds an ADQL query by copying the given one.
      Parameters:
      toCopy - The ADQL query to copy.
      Throws:
      Exception - If there is an error during the copy.
  • Method Details

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

      Returns:
      Description of this ADQL object as an ADQL's feature.
    • reset

      public void reset()
      Clear all the clauses.
      Overrides:
      reset in class ADQLSet
    • getSelect

      public final ClauseSelect getSelect()
      Gets the SELECT clause of this query.
      Returns:
      Its SELECT clause.
    • setSelect

      public void setSelect(ClauseSelect newSelect) throws NullPointerException
      Replaces its SELECT clause by the given one.

      Note: The position of the query is erased.

      Parameters:
      newSelect - The new SELECT clause.
      Throws:
      NullPointerException - If the given SELECT clause is NULL.
    • getFrom

      public final FromContent getFrom()
      Gets the FROM clause of this query.
      Returns:
      Its FROM clause.
    • setFrom

      public void setFrom(FromContent newFrom) throws NullPointerException
      Replaces its FROM clause by the given one.

      Note: The position of the query is erased.

      Parameters:
      newFrom - The new FROM clause.
      Throws:
      NullPointerException - If the given FROM clause is NULL.
    • getWhere

      public final ClauseConstraints getWhere()
      Gets the WHERE clause of this query.
      Returns:
      Its WHERE clause.
    • setWhere

      public void setWhere(ClauseConstraints newWhere) throws NullPointerException
      Replaces its WHERE clause by the given one.

      Note: The position of the query is erased.

      Parameters:
      newWhere - The new WHERE clause.
      Throws:
      NullPointerException - If the given WHERE clause is NULL.
    • getGroupBy

      public final ClauseADQL<ADQLOperand> getGroupBy()
      Gets the GROUP BY clause of this query.
      Returns:
      Its GROUP BY clause.
    • setGroupBy

      public void setGroupBy(ClauseADQL<ADQLOperand> newGroupBy) throws NullPointerException
      Replaces its GROUP BY clause by the given one.

      Note: The position of the query is erased.

      Parameters:
      newGroupBy - The new GROUP BY clause.
      Throws:
      NullPointerException - If the given GROUP BY clause is NULL.
    • getHaving

      public final ClauseConstraints getHaving()
      Gets the HAVING clause of this query.
      Returns:
      Its HAVING clause.
    • setHaving

      public void setHaving(ClauseConstraints newHaving) throws NullPointerException
      Replaces its HAVING clause by the given one.

      Note: The position of the query is erased.

      Parameters:
      newHaving - The new HAVING clause.
      Throws:
      NullPointerException - If the given HAVING clause is NULL.
    • hasLimit

      public boolean hasLimit()
      Description copied from class: ADQLSet
      Indicates whether this rows set imposes a maximum number of rows.
      Specified by:
      hasLimit in class ADQLSet
      Returns:
      true this clause has a limited number of rows, false otherwise.
    • getLimit

      public int getLimit()
      Description copied from class: ADQLSet
      Gets the maximum number of rows imposed in this rows set.
      Specified by:
      getLimit in class ADQLSet
      Returns:
      Maximum number of rows the query must return.
    • setNoLimit

      public final void setNoLimit()
      Description copied from class: ADQLSet
      Sets no maximum number of rows returned in this rows set.
      Specified by:
      setNoLimit in class ADQLSet
    • setLimit

      public final void setLimit(int limit)
      Description copied from class: ADQLSet
      Changes the maximum number of rows returned in this rows set.
      Specified by:
      setLimit in class ADQLSet
      Parameters:
      limit - The maximum number of returned rows.
    • getCopy

      public ADQLObject getCopy() throws Exception
      Description copied from interface: ADQLObject
      Gets a (deep) copy of this ADQL object.
      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.
      Returns:
      The name of this ADQL object.
    • getResultingColumns

      public DBColumn[] getResultingColumns()
      Gets the list of columns (database metadata) selected by this query.

      Note: The list is generated on the fly!

      Specified by:
      getResultingColumns in class ADQLSet
      Returns:
      Selected columns metadata.
    • 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.

      Returns:
      An ADQL objects iterator.
      See Also:
    • toADQL

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