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

public final Class CollectionMemberDeclaration

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

An identification variable declared by a collection member declaration ranges over values of a collection obtained by navigation using a path expression. Such a path expression represents a navigation involving the association-fields of an entity abstract schema type. Because a path expression can be based on another path expression, the navigation can use the association-fields of related entities. An identification variable of a collection member declaration is declared using a special operator, the reserved identifier IN. The argument to the IN operator is a collection-valued path expression. The path expression evaluates to a collection type specified as a result of navigation to a collection-valued association-field of an entity abstract schema type.
BNF: collection_member_declaration ::= IN(collection_valued_path_expression) [AS] identification_variable
or
BNF: derived_collection_member_declaration ::= IN superquery_identification_variable.{single_valued_object_field.}*collection_valued_field

Example: SELECT t FROM Player p, IN (p.teams) AS t

Author
Pascal Filion
Since
2.3
Version
2.5

Field Summary

Modifier and TypeField and Description
private String
asIdentifier

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

private AbstractExpression
collectionValuedPathExpression

The Expression representing the collection member, which is declared by an identification variable.

private boolean
hasLeftParenthesis

Flag used to determine if the closing parenthesis is present in the query.

private boolean
hasRightParenthesis

Flag used to determine if the opening parenthesis is present in the query.

private boolean
hasSpaceAfterAs

Determines whether a whitespace was parsed after AS.

private boolean
hasSpaceAfterIn

Determines whether a whitespace was parsed after IN.

private boolean
hasSpaceAfterRightParenthesis

Determines whether a whitespace was parsed after the right parenthesis.

private AbstractExpression
identificationVariable

The Expression representing the identification variable, which maps the collection- valued path expression.

private String
inIdentifier

The actual IN 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
public
CollectionMemberDeclaration(AbstractExpression
The parent of this expression
parent
)

Creates a new CollectionMemberDeclaration.

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

Returns:

The AS identifier that was actually parsed
getActualAsIdentifier
()

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

public String

Returns:

The IN identifier that was actually parsed
getActualInIdentifier
()

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

public Expression

Returns:

The expression representing the collection-valued path expression
getCollectionValuedPathExpression
()

Returns the Expression representing the collection member, which is declared by an identification variable.

public Expression

Returns:

The expression representing the identification variable
getIdentificationVariable
()

Returns the Expression representing the identification variable, which maps the collection-valued path expression.

public JPQLQueryBNF
public boolean

Returns:

true if the identifier AS was parsed; false otherwise
hasAs
()

Determines whether the identifier AS was parsed.

public boolean

Returns:

true if the query has the collection-valued path expression; false otherwise
hasCollectionValuedPathExpression
()

Determines whether the collection-valued path expression was parsed.

public boolean

Returns:

true if the query has the identification variable; false otherwise
hasIdentificationVariable
()

Determines whether the identification variable was parsed.

public boolean

Returns:

true if the open parenthesis was present in the string version of the query; false otherwise
hasLeftParenthesis
()

Determines whether the open parenthesis was parsed or not.

public boolean

Returns:

true if the close parenthesis was present in the string version of the query; false otherwise
hasRightParenthesis
()

Determines whether the close parenthesis was parsed or not.

public boolean

Returns:

true if there was a whitespace after AS; false otherwise
hasSpaceAfterAs
()

Determines whether a whitespace was found after AS.

public boolean

Returns:

true if there was a whitespace after IN; false otherwise
hasSpaceAfterIn
()

Determines whether a whitespace was found after IN.

public boolean

Returns:

true if there was a whitespace after the right parenthesis; false otherwise
hasSpaceAfterRightParenthesis
()

Determines whether a whitespace was found after the close parenthesis.

public boolean

Returns:

true if this collection member declaration is used as this form: "IN collection_valued_path_expression" in a subquery; false if it's used as this form: IN(collection_valued_path_expression) [AS] identification_variable" in a top-level or subquery queries
isDerived
()

Determines whether this collection member declaration is used as a derived collection-valued path expression.

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

Returns:

The string representation of a section of this expression
toParsedTextUntilAs
()

Creates a string representation of this expression up and excluding the AS identifier.

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

Field Detail

asIdentifierback to summary
private String asIdentifier

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

collectionValuedPathExpressionback to summary
private AbstractExpression collectionValuedPathExpression

The Expression representing the collection member, which is declared by an identification variable.

hasLeftParenthesisback to summary
private boolean hasLeftParenthesis

Flag used to determine if the closing parenthesis is present in the query.

hasRightParenthesisback to summary
private boolean hasRightParenthesis

Flag used to determine if the opening parenthesis is present in the query.

hasSpaceAfterAsback to summary
private boolean hasSpaceAfterAs

Determines whether a whitespace was parsed after AS.

hasSpaceAfterInback to summary
private boolean hasSpaceAfterIn

Determines whether a whitespace was parsed after IN.

hasSpaceAfterRightParenthesisback to summary
private boolean hasSpaceAfterRightParenthesis

Determines whether a whitespace was parsed after the right parenthesis.

identificationVariableback to summary
private AbstractExpression identificationVariable

The Expression representing the identification variable, which maps the collection- valued path expression.

inIdentifierback to summary
private String inIdentifier

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

Constructor Detail

CollectionMemberDeclarationback to summary
public CollectionMemberDeclaration(AbstractExpression parent)

Creates a new CollectionMemberDeclaration.

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
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
getActualAsIdentifierback to summary
public String getActualAsIdentifier()

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

Returns:String

The AS identifier that was actually parsed

getActualInIdentifierback to summary
public String getActualInIdentifier()

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

Returns:String

The IN identifier that was actually parsed

getCollectionValuedPathExpressionback to summary
public Expression getCollectionValuedPathExpression()

Returns the Expression representing the collection member, which is declared by an identification variable.

Returns:Expression

The expression representing the collection-valued path expression

getIdentificationVariableback to summary
public Expression getIdentificationVariable()

Returns the Expression representing the identification variable, which maps the collection-valued path expression.

Returns:Expression

The expression representing the identification variable

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
hasAsback to summary
public boolean hasAs()

Determines whether the identifier AS was parsed.

Returns:boolean

true if the identifier AS was parsed; false otherwise

hasCollectionValuedPathExpressionback to summary
public boolean hasCollectionValuedPathExpression()

Determines whether the collection-valued path expression was parsed.

Returns:boolean

true if the query has the collection-valued path expression; false otherwise

hasIdentificationVariableback to summary
public boolean hasIdentificationVariable()

Determines whether the identification variable was parsed.

Returns:boolean

true if the query has the identification variable; false otherwise

hasLeftParenthesisback to summary
public boolean hasLeftParenthesis()

Determines whether the open parenthesis was parsed or not.

Returns:boolean

true if the open parenthesis was present in the string version of the query; false otherwise

hasRightParenthesisback to summary
public boolean hasRightParenthesis()

Determines whether the close parenthesis was parsed or not.

Returns:boolean

true if the close parenthesis was present in the string version of the query; false otherwise

hasSpaceAfterAsback to summary
public boolean hasSpaceAfterAs()

Determines whether a whitespace was found after AS.

Returns:boolean

true if there was a whitespace after AS; false otherwise

hasSpaceAfterInback to summary
public boolean hasSpaceAfterIn()

Determines whether a whitespace was found after IN.

Returns:boolean

true if there was a whitespace after IN; false otherwise

hasSpaceAfterRightParenthesisback to summary
public boolean hasSpaceAfterRightParenthesis()

Determines whether a whitespace was found after the close parenthesis.

Returns:boolean

true if there was a whitespace after the right parenthesis; false otherwise

isDerivedback to summary
public boolean isDerived()

Determines whether this collection member declaration is used as a derived collection-valued path expression.

Returns:boolean

true if this collection member declaration is used as this form: "IN collection_valued_path_expression" in a subquery; false if it's used as this form: IN(collection_valued_path_expression) [AS] identification_variable" in a top-level or subquery queries

Since
2.4
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
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
toParsedTextUntilAsback to summary
public String toParsedTextUntilAs()

Creates a string representation of this expression up and excluding the AS identifier.

Returns:String

The string representation of a section of this expression