Top Description Fields Constructors Methods
org.eclipse.persistence.jpa.jpql.parser

public abstract Class AbstractSelectStatement

extends AbstractExpression
Class Inheritance
Known Direct Subclasses
org.eclipse.persistence.jpa.jpql.parser.SimpleSelectStatement, org.eclipse.persistence.jpa.jpql.parser.SelectStatement
Imports
java.util.Collection, .List, org.eclipse.persistence.jpa.jpql.WordParser

A query is an operation that retrieves data from one or more tables or views. In this reference, a top-level SELECT statement is called a query, and a query nested within another SQL statement is called a subquery.
Author
Pascal Filion
Since
2.3
Version
2.5
See Also
SelectStatement, SimpleSelectStatement

Field Summary

Modifier and TypeField and Description
private AbstractExpression
fromClause

The FROM clause of this select statement.

private AbstractExpression
groupByClause

The GROUP BY clause of this select statement.

private boolean
hasSpaceAfterFrom

Determines whether there is a whitespace after the identifier FROM.

private boolean
hasSpaceAfterGroupBy

Determines whether there is a whitespace after the identifier GROUP BY.

private boolean
hasSpaceAfterSelect

Determines whether there is a whitespace after the identifier SELECT.

private boolean
hasSpaceAfterWhere

Determines whether there is a whitespace after the identifier WHERE.

private AbstractExpression
havingClause

The HAVING clause of this select statement.

private AbstractExpression
selectClause

The SELECT clause of this select statement.

private AbstractExpression
whereClause

The WHERE clause of this select statement.

Inherited from org.eclipse.persistence.jpa.jpql.parser.AbstractExpression:
COMMADOTDOUBLE_QUOTELEFT_CURLY_BRACKETLEFT_PARENTHESISNOT_DEFINEDRIGHT_CURLY_BRACKETRIGHT_PARENTHESISSINGLE_QUOTESPACEUNDERSCORE

Constructor Summary

AccessConstructor and Description
protected
AbstractSelectStatement(AbstractExpression
The parent of this expression
parent
)

Creates a new AbstractSelectStatement.

Method Summary

Modifier and TypeMethod and Description
public void
acceptChildren(ExpressionVisitor
The visitor to visit the children of this object.
visitor
)

Implements org.eclipse.persistence.jpa.jpql.parser.Expression.acceptChildren.

Visits the children of this Expression.
protected void
addChildrenTo(Collection<Expression>
The collection used to store the children
children
)

Overrides org.eclipse.persistence.jpa.jpql.parser.AbstractExpression.addChildrenTo.

Adds the children of this AbstractExpression to the given collection.
protected void
addOrderedChildrenTo(List<Expression>
The list used to store the string representation of this AbstractExpression
children
)

Overrides org.eclipse.persistence.jpa.jpql.parser.AbstractExpression.addOrderedChildrenTo.

Adds the children of this AbstractExpression to the given list.
protected abstract AbstractFromClause

Returns:

A new from clause, null can't be returned
buildFromClause
()

Creates the expression representing the from clause of this select statement.

protected abstract AbstractSelectClause

Returns:

A new from clause, null can't be returned
buildSelectClause
()

Creates the expression representing the select clause of this select statement.

public JPQLQueryBNF
findQueryBNF(Expression
The Expression that is a descendant of this one
expression
)

Overrides org.eclipse.persistence.jpa.jpql.parser.AbstractExpression.findQueryBNF.

Implements org.eclipse.persistence.jpa.jpql.parser.Expression.findQueryBNF.

Retrieves the JPQLQueryBNF that represents the fragment of this Expression that was used when parsing the given Expression.
public final Expression

Returns:

The expression representing the FROM clause
getFromClause
()

Returns the Expression representing the FROM clause.

public final Expression

Returns:

The expression representing the GROUP BY clause
getGroupByClause
()

Returns the Expression representing the GROUP BY clause.

public final Expression

Returns:

The expression representing the HAVING clause
getHavingClause
()

Returns the Expression representing the HAVING clause.

public final Expression

Returns:

The expression representing the SELECT clause
getSelectClause
()

Returns the AbstractSelectClause representing the SELECT clause.

public final Expression

Returns:

The expression representing the WHERE clause
getWhereClause
()

Returns the Expression representing the WHERE clause.

public final boolean

Returns:

true if the query that got parsed had the FROM clause
hasFromClause
()

Determines whether the FROM clause was parsed or not.

public final boolean

Returns:

true if the query that got parsed had the GROUP BY clause
hasGroupByClause
()

Determines whether the GROUP BY clause was parsed or not.

public final boolean

Returns:

true if the query that got parsed had the HAVING clause
hasHavingClause
()

Determines whether the HAVING clause was parsed or not.

public final boolean

Returns:

true if the query that got parsed had the HAVING clause
hasSelectClause
()

Determines whether the SELECT clause was parsed or not.

public final boolean

Returns:

true if there was a whitespace after the FROM clause and owned by this expression; false otherwise
hasSpaceAfterFrom
()

Determines whether a whitespace was found after the FROM clause.

public final boolean

Returns:

true if there was a whitespace after the GROUP BY clause and owned by this expression; false otherwise
hasSpaceAfterGroupBy
()

Determines whether a whitespace was found after the GROUP BY clause.

public final boolean

Returns:

true if there was a whitespace after the SELECT clause and owned by this expression; false otherwise
hasSpaceAfterSelect
()

Determines whether a whitespace was found after the SELECT clause.

public final boolean

Returns:

true if there was a whitespace after the WHERE clause and owned by this expression; false otherwise
hasSpaceAfterWhere
()

Determines whether a whitespace was found after the WHERE clause.

public final boolean

Returns:

true if the query that got parsed had the WHERE clause
hasWhereClause
()

Determines whether the WHERE clause is defined.

protected void
parse(WordParser
The text to parse based on the current position of the cursor
wordParser
,
boolean
Determines whether the parsing system should be tolerant, meaning if it should try to parse invalid or incomplete queries
tolerant
)

Implements abstract org.eclipse.persistence.jpa.jpql.parser.AbstractExpression.parse.

Parses the query by starting at the current position, which is part of the given WordParser.
protected boolean

Returns:

true by default to keep the whitespace part of this expression; false to let the parent handle it
shouldManageSpaceAfterClause
()

Determines whether the whitespace following the HAVING clause should be managed by this expression or not.

protected void
toParsedText(StringBuilder
The buffer used to append this Expression's string representation
writer
,
boolean
Determines whether the string representation should represent what was parsed, i.e. include any "virtual" whitespace (such as ending whitespace) and the actual case of the JPQL identifiers
actual
)

Implements abstract org.eclipse.persistence.jpa.jpql.parser.AbstractExpression.toParsedText.

Generates a string representation of this Expression, including its children, if it has any.
Inherited from org.eclipse.persistence.jpa.jpql.parser.AbstractExpression:
acceptUnknownVisitoracceptUnknownVisitorbuildExpressionFromFallingBackbuildNullExpressionbuildStringExpressionbuildStringExpressionbuildUnknownExpressioncalculatePositionchildrenfindFallBackExpressionFactorygetExpressionFactorygetExpressionRegistrygetGrammargetIdentifierVersiongetJPAVersiongetLengthgetOffsetgetParentgetQueryBNFgetRootgetTexthandleAggregatehandleCollectionisAncestorisIdentifierisNullisParsingCompleteisTolerantisUnknownisVirtualorderedChildrenparseparseUsingExpressionFactorypopulatePositionrebuildActualTextrebuildParsedTextsetParentsetTextshouldParseWithFactoryFirstshouldSkipLiteraltoActualTexttoParsedTexttoString

Field Detail

fromClauseback to summary
private AbstractExpression fromClause

The FROM clause of this select statement.

groupByClauseback to summary
private AbstractExpression groupByClause

The GROUP BY clause of this select statement.

hasSpaceAfterFromback to summary
private boolean hasSpaceAfterFrom

Determines whether there is a whitespace after the identifier FROM.

hasSpaceAfterGroupByback to summary
private boolean hasSpaceAfterGroupBy

Determines whether there is a whitespace after the identifier GROUP BY.

hasSpaceAfterSelectback to summary
private boolean hasSpaceAfterSelect

Determines whether there is a whitespace after the identifier SELECT.

hasSpaceAfterWhereback to summary
private boolean hasSpaceAfterWhere

Determines whether there is a whitespace after the identifier WHERE.

havingClauseback to summary
private AbstractExpression havingClause

The HAVING clause of this select statement.

selectClauseback to summary
private AbstractExpression selectClause

The SELECT clause of this select statement.

whereClauseback to summary
private AbstractExpression whereClause

The WHERE clause of this select statement.

Constructor Detail

AbstractSelectStatementback to summary
protected AbstractSelectStatement(AbstractExpression parent)

Creates a new AbstractSelectStatement.

Parameters
parent:AbstractExpression

The parent of this expression

Method Detail

acceptChildrenback to summary
public void acceptChildren(ExpressionVisitor visitor)

Implements org.eclipse.persistence.jpa.jpql.parser.Expression.acceptChildren.

Doc from org.eclipse.persistence.jpa.jpql.parser.Expression.acceptChildren.

Visits the children of this Expression. This method can be used to optimize traversing the children since a new list is not created every time children() is called.

This does not traverse the Expression sub-hierarchy, use a subclass of AbstractTraverseChildrenVisitor in order to traverse the entire sub-hierarchy.

Parameters
visitor:ExpressionVisitor

The visitor to visit the children of this object.

Annotations
@Override
addChildrenToback to summary
protected void addChildrenTo(Collection<Expression> children)

Overrides org.eclipse.persistence.jpa.jpql.parser.AbstractExpression.addChildrenTo.

Doc from org.eclipse.persistence.jpa.jpql.parser.AbstractExpression.addChildrenTo.

Adds the children of this AbstractExpression to the given collection.

Parameters
children:Collection<Expression>

The collection used to store the children

Annotations
@Override
addOrderedChildrenToback to summary
protected void addOrderedChildrenTo(List<Expression> children)

Overrides org.eclipse.persistence.jpa.jpql.parser.AbstractExpression.addOrderedChildrenTo.

Doc from org.eclipse.persistence.jpa.jpql.parser.AbstractExpression.addOrderedChildrenTo.

Adds the children of this AbstractExpression to the given list.

Parameters
children:List<Expression>

The list used to store the string representation of this AbstractExpression

Annotations
@Override
buildFromClauseback to summary
protected abstract AbstractFromClause buildFromClause()

Creates the expression representing the from clause of this select statement.

Returns:AbstractFromClause

A new from clause, null can't be returned

buildSelectClauseback to summary
protected abstract AbstractSelectClause buildSelectClause()

Creates the expression representing the select clause of this select statement.

Returns:AbstractSelectClause

A new from clause, null can't be returned

findQueryBNFback to summary
public JPQLQueryBNF findQueryBNF(Expression expression)

Overrides org.eclipse.persistence.jpa.jpql.parser.AbstractExpression.findQueryBNF.

Implements org.eclipse.persistence.jpa.jpql.parser.Expression.findQueryBNF.

Doc from org.eclipse.persistence.jpa.jpql.parser.Expression.findQueryBNF.

Retrieves the JPQLQueryBNF that represents the fragment of this Expression that was used when parsing the given Expression.

Parameters
expression:Expression

The Expression that is a descendant of this one

Returns:JPQLQueryBNF

The JPQLQueryBNF that was used to parse the given expression

Annotations
@Override
getFromClauseback to summary
public final Expression getFromClause()

Returns the Expression representing the FROM clause.

Returns:Expression

The expression representing the FROM clause

getGroupByClauseback to summary
public final Expression getGroupByClause()

Returns the Expression representing the GROUP BY clause.

Returns:Expression

The expression representing the GROUP BY clause

getHavingClauseback to summary
public final Expression getHavingClause()

Returns the Expression representing the HAVING clause.

Returns:Expression

The expression representing the HAVING clause

getSelectClauseback to summary
public final Expression getSelectClause()

Returns the AbstractSelectClause representing the SELECT clause.

Returns:Expression

The expression representing the SELECT clause

getWhereClauseback to summary
public final Expression getWhereClause()

Returns the Expression representing the WHERE clause.

Returns:Expression

The expression representing the WHERE clause

hasFromClauseback to summary
public final boolean hasFromClause()

Determines whether the FROM clause was parsed or not.

Returns:boolean

true if the query that got parsed had the FROM clause

hasGroupByClauseback to summary
public final boolean hasGroupByClause()

Determines whether the GROUP BY clause was parsed or not.

Returns:boolean

true if the query that got parsed had the GROUP BY clause

hasHavingClauseback to summary
public final boolean hasHavingClause()

Determines whether the HAVING clause was parsed or not.

Returns:boolean

true if the query that got parsed had the HAVING clause

hasSelectClauseback to summary
public final boolean hasSelectClause()

Determines whether the SELECT clause was parsed or not.

Returns:boolean

true if the query that got parsed had the HAVING clause

Since
2.5
hasSpaceAfterFromback to summary
public final boolean hasSpaceAfterFrom()

Determines whether a whitespace was found after the FROM clause. In some cases, the space is owned by a child of the FROM clause.

Returns:boolean

true if there was a whitespace after the FROM clause and owned by this expression; false otherwise

hasSpaceAfterGroupByback to summary
public final boolean hasSpaceAfterGroupBy()

Determines whether a whitespace was found after the GROUP BY clause. In some cases, the space is owned by a child of the GROUP BY clause.

Returns:boolean

true if there was a whitespace after the GROUP BY clause and owned by this expression; false otherwise

hasSpaceAfterSelectback to summary
public final boolean hasSpaceAfterSelect()

Determines whether a whitespace was found after the SELECT clause. In some cases, the space is owned by a child of the SELECT clause.

Returns:boolean

true if there was a whitespace after the SELECT clause and owned by this expression; false otherwise

hasSpaceAfterWhereback to summary
public final boolean hasSpaceAfterWhere()

Determines whether a whitespace was found after the WHERE clause. In some cases, the space is owned by a child of the WHERE clause.

Returns:boolean

true if there was a whitespace after the WHERE clause and owned by this expression; false otherwise

hasWhereClauseback to summary
public final boolean hasWhereClause()

Determines whether the WHERE clause is defined.

Returns:boolean

true if the query that got parsed had the WHERE clause

parseback to summary
protected void parse(WordParser wordParser, boolean tolerant)

Implements abstract org.eclipse.persistence.jpa.jpql.parser.AbstractExpression.parse.

Doc from org.eclipse.persistence.jpa.jpql.parser.AbstractExpression.parse.

Parses the query by starting at the current position, which is part of the given WordParser.

Parameters
wordParser:WordParser

The text to parse based on the current position of the cursor

tolerant:boolean

Determines whether the parsing system should be tolerant, meaning if it should try to parse invalid or incomplete queries

Annotations
@Override
shouldManageSpaceAfterClauseback to summary
protected boolean shouldManageSpaceAfterClause()

Determines whether the whitespace following the HAVING clause should be managed by this expression or not.

Returns:boolean

true by default to keep the whitespace part of this expression; false to let the parent handle it

toParsedTextback to summary
protected void toParsedText(StringBuilder writer, boolean actual)

Implements abstract org.eclipse.persistence.jpa.jpql.parser.AbstractExpression.toParsedText.

Doc from org.eclipse.persistence.jpa.jpql.parser.AbstractExpression.toParsedText.

Generates a string representation of this Expression, including its children, if it has any.

Parameters
writer:StringBuilder

The buffer used to append this Expression's string representation

actual:boolean

Determines whether the string representation should represent what was parsed, i.e. include any "virtual" whitespace (such as ending whitespace) and the actual case of the JPQL identifiers

Annotations
@Override