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

public abstract Class CompoundExpression

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

A compound expression has a left and right expressions combined by an identifier.
BNF: expression ::= left_expression identifier right_expression
Author
Pascal Filion
Since
2.3
Version
2.5

Field Summary

Modifier and TypeField and Description
private boolean
hasSpaceAfterIdentifier

Determines whether a whitespace is present after the identifier.

private String
identifier

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

private AbstractExpression
leftExpression

The left side of the arithmetic expression.

private AbstractExpression
rightExpression

The right side of the arithmetic expression.

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
CompoundExpression(AbstractExpression
The parent of this expression
parent
,
String
The identifier of this expression
identifier
)

Creates a new CompoundExpression.

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

Returns:

The JPQL identifier that was actually parsed
getActualIdentifier
()

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

public String

Returns:

The JPQL identifier
getIdentifier
()

Returns the JPQL identifier of this expression.

public final Expression

Returns:

The expression that was parsed representing the first expression
getLeftExpression
()

Returns the Expression that represents the first expression, which is before the identifier.

public abstract String

Returns:

The ID of the BNF used when parsing the expression before the identifier
getLeftExpressionQueryBNFId
()

Returns the unique identifier of the JPQLQueryBNF for the left expression.

public final Expression

Returns:

The expression that was parsed representing the second expression
getRightExpression
()

Returns the Expression that represents the second expression, which is after the identifier.

public abstract String

Returns:

The ID of the BNF used when parsing the expression after the identifier
getRightExpressionQueryBNFId
()

Returns the unique identifier of the JPQLQueryBNF for the right expression.

public final boolean

Returns:

true if the first expression was parsed; false if it was not parsed
hasLeftExpression
()

Determines whether the first expression of the query was parsed.

public final boolean

Returns:

true if the second expression was parsed; false if it was not parsed
hasRightExpression
()

Determines whether the second expression of the query was parsed.

public final boolean

Returns:

true if there was a whitespace after the identifier; false otherwise
hasSpaceAfterIdentifier
()

Determines whether a whitespace was parsed after the identifier.

protected final 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 abstract String

Returns:

The identifier for this expression
parseIdentifier
(WordParser
The WordParser containing the text to parse, which starts with the identifier
wordParser
)

Parses the identifier of this expression.

protected final void
setLeftExpression(AbstractExpression
The expression that was parsed before the identifier
leftExpression
)

Sets the given Expression to be the first expression of this compound one.

protected final void
setRightExpression(AbstractExpression
The expression that was parsed after the identifier
rightExpression
)

Sets the given Expression to be the second expression of this compound one.

protected final 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

hasSpaceAfterIdentifierback to summary
private boolean hasSpaceAfterIdentifier

Determines whether a whitespace is present after the identifier.

identifierback to summary
private String identifier

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

leftExpressionback to summary
private AbstractExpression leftExpression

The left side of the arithmetic expression.

rightExpressionback to summary
private AbstractExpression rightExpression

The right side of the arithmetic expression.

Constructor Detail

CompoundExpressionback to summary
protected CompoundExpression(AbstractExpression parent, String identifier)

Creates a new CompoundExpression.

Parameters
parent:AbstractExpression

The parent of this expression

identifier:String

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

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

Returns:String

The JPQL identifier that was actually parsed

getIdentifierback to summary
public String getIdentifier()

Returns the JPQL identifier of this expression.

Returns:String

The JPQL identifier

getLeftExpressionback to summary
public final Expression getLeftExpression()

Returns the Expression that represents the first expression, which is before the identifier.

Returns:Expression

The expression that was parsed representing the first expression

getLeftExpressionQueryBNFIdback to summary
public abstract String getLeftExpressionQueryBNFId()

Returns the unique identifier of the JPQLQueryBNF for the left expression.

Returns:String

The ID of the BNF used when parsing the expression before the identifier

getRightExpressionback to summary
public final Expression getRightExpression()

Returns the Expression that represents the second expression, which is after the identifier.

Returns:Expression

The expression that was parsed representing the second expression

getRightExpressionQueryBNFIdback to summary
public abstract String getRightExpressionQueryBNFId()

Returns the unique identifier of the JPQLQueryBNF for the right expression.

Returns:String

The ID of the BNF used when parsing the expression after the identifier

hasLeftExpressionback to summary
public final boolean hasLeftExpression()

Determines whether the first expression of the query was parsed.

Returns:boolean

true if the first expression was parsed; false if it was not parsed

hasRightExpressionback to summary
public final boolean hasRightExpression()

Determines whether the second expression of the query was parsed.

Returns:boolean

true if the second expression was parsed; false if it was not parsed

hasSpaceAfterIdentifierback to summary
public final boolean hasSpaceAfterIdentifier()

Determines whether a whitespace was parsed after the identifier.

Returns:boolean

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

parseback to summary
protected final 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
parseIdentifierback to summary
protected abstract String parseIdentifier(WordParser wordParser)

Parses the identifier of this expression.

Parameters
wordParser:WordParser

The WordParser containing the text to parse, which starts with the identifier

Returns:String

The identifier for this expression

setLeftExpressionback to summary
protected final void setLeftExpression(AbstractExpression leftExpression)

Sets the given Expression to be the first expression of this compound one.

Parameters
leftExpression:AbstractExpression

The expression that was parsed before the identifier

setRightExpressionback to summary
protected final void setRightExpression(AbstractExpression rightExpression)

Sets the given Expression to be the second expression of this compound one.

Parameters
rightExpression:AbstractExpression

The expression that was parsed after the identifier

toParsedTextback to summary
protected final 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