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

public abstract Class AbstractFromClause

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

The FROM clause of a query defines the domain of the query by declaring identification variables. An identification variable is an identifier declared in the FROM clause of a query. The domain of the query may be constrained by path expressions. Identification variables designate instances of a particular entity abstract schema type. The FROM clause can contain multiple identification variable declarations separated by a comma (,).
Author
Pascal Filion
Since
2.3
Version
2.5
See Also
FromClause, SimpleFromClause

Field Summary

Modifier and TypeField and Description
private AbstractExpression
asOfClause

The Expression that represents the AS OF clause.

private AbstractExpression
declaration

The declaration portion of this FROM clause.

private boolean
hasSpace

Determines whether a whitespace was parsed after the identifier FROM.

private boolean
hasSpaceAfterHierarchicalQueryClause

Determines whether there is a whitespace after the hierarchical query clause.

private boolean
hasSpaceDeclaration

Determines whether there is a whitespace after the declaration and either the hierarchical query clause or the AS OF clause was parsed.

private AbstractExpression
hierarchicalQueryClause

The hierarchical query clause, which holds onto the START WITH and CONNECT BY clauses.

private String
identifier

The actual identifier found in the string representation of the JPQL query.

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
AbstractFromClause(AbstractExpression
The parent of this expression
parent
)

Creates a new AbstractFromClause.

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.
public final CollectionExpression

Returns:

The single declaration represented by a temporary collection
buildCollectionExpression
()

Creates a new CollectionExpression that will wrap the single declaration.

public final 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 String

Returns:

The FROM identifier that was actually parsed
getActualIdentifier
()

Returns the actual FROM identifier found in the string representation of the JPQL query, which has the actual case that was used.

public final Expression

Returns:

The expression representing the AS OF clause
getAsOfClause
()

Returns the Expression representing the AS OF clause.

public final Expression

Returns:

The expression that was parsed representing the declaration
getDeclaration
()

Returns the Expression that represents the declaration of this clause.

public abstract String

Returns:

The BNF of the declaration part of this clause
getDeclarationQueryBNFId
()

Returns the BNF of the declaration part of this clause.

public final Expression

Returns:

The expression representing the hierarchical query clause
getHierarchicalQueryClause
()

Returns the Expression representing the hierarchical query clause.

public final boolean

Returns:

true if the query that got parsed had the AS OF clause
hasAsOfClause
()

Determines whether the AS OF clause is defined.

public final boolean

Returns:

true if the declaration of this clause was parsed; false if it was not parsed
hasDeclaration
()

Determines whether the declaration of this clause was parsed.

public final boolean

Returns:

true if the query that got parsed had the hierarchical query clause
hasHierarchicalQueryClause
()

Determines whether the hierarchical query clause was parsed or not.

public final boolean

Returns:

true if there was a whitespace after the declaration; false otherwise
hasSpaceAfterDeclaration
()

Determines whether a whitespace was found after the declaration query clause, which will be true if it's followed by either the hierarchical query clause or the AS OF clause.

public final boolean

Returns:

true if a whitespace was parsed after the FROM identifier; false otherwise
hasSpaceAfterFrom
()

Determines whether a whitespace was parsed after the FROM identifier.

public final boolean

Returns:

true if there was a whitespace after the hierarchical query clause and owned by this expression; false otherwise
hasSpaceAfterHierarchicalQueryClause
()

Determines whether a whitespace was found after the hierarchical query clause.

protected boolean
isParsingComplete(WordParser
The text to parse based on the current position of the cursor
wordParser
,
String
The word that was retrieved from the given text, which is the first word in the text
word
,
Expression
The Expression that has already been parsed
expression
)

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

Determines whether the parsing is complete based on what is left in the given text.
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
shouldParseWithFactoryFirst()

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

Determines whether the parsing of the query should be performed using the factories first or it should automatically fallback to the fallback factory.
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:
acceptUnknownVisitoracceptUnknownVisitorbuildExpressionFromFallingBackbuildNullExpressionbuildStringExpressionbuildStringExpressionbuildUnknownExpressioncalculatePositionchildrenfindFallBackExpressionFactorygetExpressionFactorygetExpressionRegistrygetGrammargetIdentifierVersiongetJPAVersiongetLengthgetOffsetgetParentgetQueryBNFgetRootgetTexthandleAggregatehandleCollectionisAncestorisIdentifierisNullisTolerantisUnknownisVirtualorderedChildrenparseparseUsingExpressionFactorypopulatePositionrebuildActualTextrebuildParsedTextsetParentsetTextshouldSkipLiteraltoActualTexttoParsedTexttoString

Field Detail

asOfClauseback to summary
private AbstractExpression asOfClause

The Expression that represents the AS OF clause.

Since
2.5
declarationback to summary
private AbstractExpression declaration

The declaration portion of this FROM clause.

hasSpaceback to summary
private boolean hasSpace

Determines whether a whitespace was parsed after the identifier FROM.

hasSpaceAfterHierarchicalQueryClauseback to summary
private boolean hasSpaceAfterHierarchicalQueryClause

Determines whether there is a whitespace after the hierarchical query clause.

Since
2.5
hasSpaceDeclarationback to summary
private boolean hasSpaceDeclaration

Determines whether there is a whitespace after the declaration and either the hierarchical query clause or the AS OF clause was parsed.

Since
2.5
hierarchicalQueryClauseback to summary
private AbstractExpression hierarchicalQueryClause

The hierarchical query clause, which holds onto the START WITH and CONNECT BY clauses.

Since
2.5
identifierback to summary
private String identifier

The actual identifier found in the string representation of the JPQL query.

Constructor Detail

AbstractFromClauseback to summary
protected AbstractFromClause(AbstractExpression parent)

Creates a new AbstractFromClause.

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
buildCollectionExpressionback to summary
public final CollectionExpression buildCollectionExpression()

Creates a new CollectionExpression that will wrap the single declaration.

Returns:CollectionExpression

The single declaration represented by a temporary collection

findQueryBNFback to summary
public final 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
getActualIdentifierback to summary
public final String getActualIdentifier()

Returns the actual FROM identifier found in the string representation of the JPQL query, which has the actual case that was used.

Returns:String

The FROM identifier that was actually parsed

getAsOfClauseback to summary
public final Expression getAsOfClause()

Returns the Expression representing the AS OF clause.

Returns:Expression

The expression representing the AS OF clause

getDeclarationback to summary
public final Expression getDeclaration()

Returns the Expression that represents the declaration of this clause.

Returns:Expression

The expression that was parsed representing the declaration

getDeclarationQueryBNFIdback to summary
public abstract String getDeclarationQueryBNFId()

Returns the BNF of the declaration part of this clause.

Returns:String

The BNF of the declaration part of this clause

getHierarchicalQueryClauseback to summary
public final Expression getHierarchicalQueryClause()

Returns the Expression representing the hierarchical query clause.

Returns:Expression

The expression representing the hierarchical query clause

Since
2.5
hasAsOfClauseback to summary
public final boolean hasAsOfClause()

Determines whether the AS OF clause is defined.

Returns:boolean

true if the query that got parsed had the AS OF clause

hasDeclarationback to summary
public final boolean hasDeclaration()

Determines whether the declaration of this clause was parsed.

Returns:boolean

true if the declaration of this clause was parsed; false if it was not parsed

hasHierarchicalQueryClauseback to summary
public final boolean hasHierarchicalQueryClause()

Determines whether the hierarchical query clause was parsed or not.

Returns:boolean

true if the query that got parsed had the hierarchical query clause

Since
2.5
hasSpaceAfterDeclarationback to summary
public final boolean hasSpaceAfterDeclaration()

Determines whether a whitespace was found after the declaration query clause, which will be true if it's followed by either the hierarchical query clause or the AS OF clause.

Returns:boolean

true if there was a whitespace after the declaration; false otherwise

Since
2.5
hasSpaceAfterFromback to summary
public final boolean hasSpaceAfterFrom()

Determines whether a whitespace was parsed after the FROM identifier.

Returns:boolean

true if a whitespace was parsed after the FROM identifier; false otherwise

hasSpaceAfterHierarchicalQueryClauseback to summary
public final boolean hasSpaceAfterHierarchicalQueryClause()

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

Returns:boolean

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

Since
2.5
isParsingCompleteback to summary
protected boolean isParsingComplete(WordParser wordParser, String word, Expression expression)

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

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

Determines whether the parsing is complete based on what is left in the given text. The text is never empty.

Parameters
wordParser:WordParser

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

word:String

The word that was retrieved from the given text, which is the first word in the text

expression:Expression

The Expression that has already been parsed

Returns:boolean

true if the text no longer can't be parsed by the current expression; false if more can be parsed

Annotations
@Override
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
shouldParseWithFactoryFirstback to summary
protected boolean shouldParseWithFactoryFirst()

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

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

Determines whether the parsing of the query should be performed using the factories first or it should automatically fallback to the fallback factory.

Returns:boolean

true is returned by default so the factories are used before falling back

Annotations
@Override
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