public class ADQLQuery extends java.lang.Object implements ADQLObject
Object representation of an ADQL query or sub-query.
The resulting object of the ADQLParser
is an object of this class.
Constructor and Description |
---|
ADQLQuery()
Builds an empty ADQL query.
|
ADQLQuery(ADQLQuery toCopy)
Builds an ADQL query by copying the given one.
|
Modifier and Type | Method and Description |
---|---|
ADQLIterator |
adqlIterator()
Gets an iterator on the intern ADQL objects.
|
ADQLObject |
getCopy()
Gets a (deep) copy of this ADQL object.
|
FromContent |
getFrom()
Gets the FROM clause of this query.
|
ClauseADQL<ADQLColumn> |
getGroupBy()
Gets the GROUP BY clause of this query.
|
ClauseConstraints |
getHaving()
Gets the HAVING clause of this query.
|
java.lang.String |
getName()
Gets the name of this object in ADQL.
|
ClauseADQL<ADQLOrder> |
getOrderBy()
Gets the ORDER BY clause of this query.
|
TextPosition |
getPosition()
Gets the position of this object/token in the ADQL query.
|
DBColumn[] |
getResultingColumns()
Gets the list of columns (database metadata) selected by this query.
|
ClauseSelect |
getSelect()
Gets the SELECT clause of this query.
|
ClauseConstraints |
getWhere()
Gets the WHERE clause of this query.
|
void |
reset()
Clear all the clauses.
|
java.util.Iterator<ADQLObject> |
search(ISearchHandler sHandler)
Lets searching ADQL objects into this ADQL query thanks to the given search handler.
|
void |
setFrom(FromContent newFrom)
Replaces its FROM clause by the given one.
|
void |
setGroupBy(ClauseADQL<ADQLColumn> newGroupBy)
Replaces its GROUP BY clause by the given one.
|
void |
setHaving(ClauseConstraints newHaving)
Replaces its HAVING clause by the given one.
|
void |
setOrderBy(ClauseADQL<ADQLOrder> newOrderBy)
Replaces its ORDER BY clause by the given one.
|
void |
setPosition(TextPosition position)
Set the position of this
ADQLQuery (or sub-query) inside the whole given ADQL query string. |
void |
setSelect(ClauseSelect newSelect)
Replaces its SELECT clause by the given one.
|
void |
setWhere(ClauseConstraints newWhere)
Replaces its WHERE clause by the given one.
|
java.lang.String |
toADQL()
Gets the ADQL expression of this object.
|
public ADQLQuery()
public ADQLQuery(ADQLQuery toCopy) throws java.lang.Exception
toCopy
- The ADQL query to copy.java.lang.Exception
- If there is an error during the copy.public void reset()
public final ClauseSelect getSelect()
public void setSelect(ClauseSelect newSelect) throws java.lang.NullPointerException
Replaces its SELECT clause by the given one.
note: the position of the query is erased.
newSelect
- The new SELECT clause.java.lang.NullPointerException
- If the given SELECT clause is null.public final FromContent getFrom()
public void setFrom(FromContent newFrom) throws java.lang.NullPointerException
Replaces its FROM clause by the given one.
note: the position of the query is erased.
newFrom
- The new FROM clause.java.lang.NullPointerException
- If the given FROM clause is null.public final ClauseConstraints getWhere()
public void setWhere(ClauseConstraints newWhere) throws java.lang.NullPointerException
Replaces its WHERE clause by the given one.
note: the position of the query is erased.
newWhere
- The new WHERE clause.java.lang.NullPointerException
- If the given WHERE clause is null.public final ClauseADQL<ADQLColumn> getGroupBy()
public void setGroupBy(ClauseADQL<ADQLColumn> newGroupBy) throws java.lang.NullPointerException
Replaces its GROUP BY clause by the given one.
note: the position of the query is erased.
newGroupBy
- The new GROUP BY clause.java.lang.NullPointerException
- If the given GROUP BY clause is null.public final ClauseConstraints getHaving()
public void setHaving(ClauseConstraints newHaving) throws java.lang.NullPointerException
Replaces its HAVING clause by the given one.
note: the position of the query is erased.
newHaving
- The new HAVING clause.java.lang.NullPointerException
- If the given HAVING clause is null.public final ClauseADQL<ADQLOrder> getOrderBy()
public void setOrderBy(ClauseADQL<ADQLOrder> newOrderBy) throws java.lang.NullPointerException
Replaces its ORDER BY clause by the given one.
note: the position of the query is erased.
newOrderBy
- The new ORDER BY clause.java.lang.NullPointerException
- If the given ORDER BY clause is null.public final TextPosition getPosition()
ADQLObject
Gets the position of this object/token in the ADQL query.
By default, no position should be set.
getPosition
in interface ADQLObject
public final void setPosition(TextPosition position)
ADQLQuery
(or sub-query) inside the whole given ADQL query string.position
- New position of this ADQLQuery
.public ADQLObject getCopy() throws java.lang.Exception
ADQLObject
getCopy
in interface ADQLObject
java.lang.Exception
- If there is any error during the copy.public java.lang.String getName()
ADQLObject
getName
in interface ADQLObject
public DBColumn[] getResultingColumns()
Gets the list of columns (database metadata) selected by this query.
Note: The list is generated on the fly !
public java.util.Iterator<ADQLObject> search(ISearchHandler sHandler)
sHandler
- A search handler.public ADQLIterator adqlIterator()
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.
adqlIterator
in interface ADQLObject
ADQLIterator
,
ISearchHandler
public java.lang.String toADQL()
ADQLObject
toADQL
in interface ADQLObject