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

public final Class IdentificationVariableDeclaration

extends AbstractExpression
Class Inheritance
Imports
java.util.ArrayList, .Collection, .List, org.eclipse.persistence.jpa.jpql.WordParser

An identification variable is a valid identifier declared in the FROM clause of a query. All identification variables must be declared in the FROM clause. Identification variables cannot be declared in other clauses. An identification variable must not be a reserved identifier or have the same name as any entity in the same persistence unit: Identification variables are case insensitive. An identification variable evaluates to a value of the type of the expression used in declaring the variable.
BNF: identification_variable_declaration ::= range_variable_declaration { join | fetch_join }*
Author
Pascal Filion
Since
2.3
Version
2.5

Field Summary

Modifier and TypeField and Description
private boolean
hasSpace

Determines whether there is a space after the range variable declaration.

private AbstractExpression
joins

The unique join (fetch join) or list of join (fetch join) expression or a null expression if none was declared.

private boolean
parsingJoinExpression

Flag used to determine how to check if the parsing is complete.

private AbstractExpression
rangeVariableDeclaration

The variable declaration, which is the abstract schema name and the variable.

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

Constructor Summary

AccessConstructor and Description
public
IdentificationVariableDeclaration(AbstractExpression
The parent of this expression
parent
)

Creates a new IdentificationVariableDeclaration.

Method Summary

Modifier and TypeMethod and Description
public void
accept(ExpressionVisitor
The ExpressionVisitor to visit this object
visitor
)

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

Visits this Expression by the given visitor.
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 CollectionExpression

Returns:

The single join expression represented by a temporary collection
buildCollectionExpression
()

Creates a new CollectionExpression that will wrap the single join expression.

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 Expression

Returns:

The JOIN expression(s) or a null expression if none was declared
getJoins
()

Returns the unique join (fetch join) or the list of joins (fetch joins) expression.

public JPQLQueryBNF
public Expression

Returns:

The Expression representing the range variable declaration
getRangeVariableDeclaration
()

Returns the variable declaration, which is the abstract schema name and the identification variable.

public boolean

Returns:

true if at least one join expression was specified; false otherwise
hasJoins
()

Determines whether this declaration has any join expressions.

public boolean

Returns:

true if the range variable declaration was parsed; false otherwise
hasRangeVariableDeclaration
()

Determines whether the range variable declaration was parsed.

public boolean

Returns:

true if the range variable declaration is followed by a space, false otherwise
hasSpace
()

Determines whether there is a space after the range variable declaration.

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

hasSpaceback to summary
private boolean hasSpace

Determines whether there is a space after the range variable declaration.

joinsback to summary
private AbstractExpression joins

The unique join (fetch join) or list of join (fetch join) expression or a null expression if none was declared.

parsingJoinExpressionback to summary
private boolean parsingJoinExpression

Flag used to determine how to check if the parsing is complete.

rangeVariableDeclarationback to summary
private AbstractExpression rangeVariableDeclaration

The variable declaration, which is the abstract schema name and the variable.

Constructor Detail

IdentificationVariableDeclarationback to summary
public IdentificationVariableDeclaration(AbstractExpression parent)

Creates a new IdentificationVariableDeclaration.

Parameters
parent:AbstractExpression

The parent of this expression

Method Detail

acceptback to summary
public void accept(ExpressionVisitor visitor)

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

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

Visits this Expression by the given visitor.

Parameters
visitor:ExpressionVisitor

The ExpressionVisitor to visit this object

Annotations
@Override
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 CollectionExpression buildCollectionExpression()

Creates a new CollectionExpression that will wrap the single join expression.

Returns:CollectionExpression

The single join expression represented by a temporary collection

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
getJoinsback to summary
public Expression getJoins()

Returns the unique join (fetch join) or the list of joins (fetch joins) expression.

Returns:Expression

The JOIN expression(s) or a null expression if none was declared

getQueryBNFback to summary
public JPQLQueryBNF getQueryBNF()

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

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

Returns the BNF of this Expression.

Returns:JPQLQueryBNF

The JPQLQueryBNF, which represents the grammar of this Expression

Annotations
@Override
getRangeVariableDeclarationback to summary
public Expression getRangeVariableDeclaration()

Returns the variable declaration, which is the abstract schema name and the identification variable.

Returns:Expression

The Expression representing the range variable declaration

hasJoinsback to summary
public boolean hasJoins()

Determines whether this declaration has any join expressions.

Returns:boolean

true if at least one join expression was specified; false otherwise

hasRangeVariableDeclarationback to summary
public boolean hasRangeVariableDeclaration()

Determines whether the range variable declaration was parsed.

Returns:boolean

true if the range variable declaration was parsed; false otherwise

hasSpaceback to summary
public boolean hasSpace()

Determines whether there is a space after the range variable declaration.

Returns:boolean

true if the range variable declaration is followed by a space, false otherwise

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