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

public abstract Class AbstractDoubleEncapsulatedExpression

extends AbstractEncapsulatedExpression
Class Inheritance
Known Direct Subclasses
org.eclipse.persistence.jpa.jpql.parser.DatabaseType, org.eclipse.persistence.jpa.jpql.parser.MathDoubleExpression, org.eclipse.persistence.jpa.jpql.parser.ModExpression, org.eclipse.persistence.jpa.jpql.parser.NullIfExpression
Imports
java.util.ArrayList, .Collection, .List, org.eclipse.persistence.jpa.jpql.WordParser

This Expression takes care of parsing an expression that encapsulates two expressions separated by a comma.
BNF: expression ::= <identifier>(first_expression, second_expression)
Author
Pascal Filion
Since
2.3
Version
2.5.1
See Also
ConcatExpression, ModExpression, NullIfExpression

Field Summary

Modifier and TypeField and Description
private AbstractExpression
firstExpression

The Expression that represents the first expression.

private boolean
hasComma

Determines whether the comma separating the first and second expression was parsed.

private boolean
hasSpaceAfterComma

Determines whether a whitespace is following the comma.

private AbstractExpression
secondExpression

The Expression that represents the second expression.

Constructor Summary

AccessConstructor and Description
protected
AbstractDoubleEncapsulatedExpression(AbstractExpression
The parent of this expression
parent
,
String
The JPQL identifier that starts this expression
identifier
)

Creates a new AbstractDoubleEncapsulatedExpression.

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
addOrderedEncapsulatedExpressionTo(List<Expression>
The list used to store the string representation of the encapsulated Expression
children
)

Implements abstract org.eclipse.persistence.jpa.jpql.parser.AbstractEncapsulatedExpression.addOrderedEncapsulatedExpressionTo.

Adds the Expressions representing the encapsulated Expression.
public final CollectionExpression

Returns:

The first and second expressions wrapped by a temporary collection
buildCollectionExpression
()

Creates a new CollectionExpression that will wrap the first and second expressions.

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 that was parsed representing the first expression
getFirstExpression
()

Returns the Expression that represents the first expression.

public final Expression

Returns:

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

Returns the Expression that represents the second expression.

public final boolean

Returns:

true if a comma was parsed after the first expression; false otherwise
hasComma
()

Determines whether the comma was parsed after the first expression.

public boolean
hasEncapsulatedExpression()

Implements abstract org.eclipse.persistence.jpa.jpql.parser.AbstractEncapsulatedExpression.hasEncapsulatedExpression.

Determines whether something was parsed after the left parenthesis.
public final boolean

Returns:

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

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
hasSecondExpression
()

Determines whether the second expression of the query was parsed.

public final boolean

Returns:

true if there was a whitespace after the comma; false otherwise
hasSpaceAfterComma
()

Determines whether a whitespace was parsed after the comma.

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.AbstractEncapsulatedExpression.isParsingComplete.

Determines whether the parsing is complete based on what is left in the given text.
protected boolean

Returns:

true if the second expression is optional; false if it is required
isSecondExpressionOptional
()

Determines whether the second expression is optional or not.

public abstract String

Returns:

The BNF to be used to parse one of the encapsulated expression
parameterExpressionBNF
(int
The position of the encapsulated Expression that needs to be parsed within the parenthesis, which starts at position 0
index
)

Returns the BNF to be used to parse one of the encapsulated expression.

protected void
parseEncapsulatedExpression(WordParser
The text to parse based on the current position of the cursor
wordParser
,
int
The number of whitespace characters that were parsed after '('
whitespaceCount
,
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.AbstractEncapsulatedExpression.parseEncapsulatedExpression.

Parses the encapsulated expression by starting at the current position, which is part of the given WordParser.
protected void
removeEncapsulatedExpression()

Implements abstract org.eclipse.persistence.jpa.jpql.parser.AbstractEncapsulatedExpression.removeEncapsulatedExpression.

Removes the encapsulated Expression that was parsed, it should not be part of this one.
protected void
toParsedTextEncapsulatedExpression(StringBuilder
The buffer used to append the encapsulated Expression's string representation
writer
,
boolean
Determines whether to include any characters that are considered virtual, i.e. that was parsed when the query is incomplete and is needed for functionality like content assist
actual
)

Implements abstract org.eclipse.persistence.jpa.jpql.parser.AbstractEncapsulatedExpression.toParsedTextEncapsulatedExpression.

Generates a string representation of the encapsulated Expression.
Inherited from org.eclipse.persistence.jpa.jpql.parser.AbstractEncapsulatedExpression:
addOrderedChildrenToareLogicalIdentifiersSupportedgetActualIdentifiergetIdentifierhasLeftParenthesishasRightParenthesishasSpaceAfterIdentifierparseshouldParseRightParenthesistoParsedText

Field Detail

firstExpressionback to summary
private AbstractExpression firstExpression

The Expression that represents the first expression.

hasCommaback to summary
private boolean hasComma

Determines whether the comma separating the first and second expression was parsed.

hasSpaceAfterCommaback to summary
private boolean hasSpaceAfterComma

Determines whether a whitespace is following the comma.

secondExpressionback to summary
private AbstractExpression secondExpression

The Expression that represents the second expression.

Constructor Detail

AbstractDoubleEncapsulatedExpressionback to summary
protected AbstractDoubleEncapsulatedExpression(AbstractExpression parent, String identifier)

Creates a new AbstractDoubleEncapsulatedExpression.

Parameters
parent:AbstractExpression

The parent of this expression

identifier:String

The JPQL identifier that starts 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
addOrderedEncapsulatedExpressionToback to summary
protected void addOrderedEncapsulatedExpressionTo(List<Expression> children)

Implements abstract org.eclipse.persistence.jpa.jpql.parser.AbstractEncapsulatedExpression.addOrderedEncapsulatedExpressionTo.

Doc from org.eclipse.persistence.jpa.jpql.parser.AbstractEncapsulatedExpression.addOrderedEncapsulatedExpressionTo.

Adds the Expressions representing the encapsulated Expression.

Parameters
children:List<Expression>

The list used to store the string representation of the encapsulated Expression

Annotations
@Override
buildCollectionExpressionback to summary
public final CollectionExpression buildCollectionExpression()

Creates a new CollectionExpression that will wrap the first and second expressions.

Returns:CollectionExpression

The first and second expressions wrapped 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
getFirstExpressionback to summary
public final Expression getFirstExpression()

Returns the Expression that represents the first expression.

Returns:Expression

The expression that was parsed representing the first expression

getSecondExpressionback to summary
public final Expression getSecondExpression()

Returns the Expression that represents the second expression.

Returns:Expression

The expression that was parsed representing the second expression

hasCommaback to summary
public final boolean hasComma()

Determines whether the comma was parsed after the first expression.

Returns:boolean

true if a comma was parsed after the first expression; false otherwise

hasEncapsulatedExpressionback to summary
public boolean hasEncapsulatedExpression()

Implements abstract org.eclipse.persistence.jpa.jpql.parser.AbstractEncapsulatedExpression.hasEncapsulatedExpression.

Doc from org.eclipse.persistence.jpa.jpql.parser.AbstractEncapsulatedExpression.hasEncapsulatedExpression.

Determines whether something was parsed after the left parenthesis.

Returns:boolean

true if something was parsed; false otherwise

Annotations
@Override
hasFirstExpressionback to summary
public final boolean hasFirstExpression()

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

hasSecondExpressionback to summary
public final boolean hasSecondExpression()

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

hasSpaceAfterCommaback to summary
public final boolean hasSpaceAfterComma()

Determines whether a whitespace was parsed after the comma.

Returns:boolean

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

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

Overrides org.eclipse.persistence.jpa.jpql.parser.AbstractEncapsulatedExpression.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
isSecondExpressionOptionalback to summary
protected boolean isSecondExpressionOptional()

Determines whether the second expression is optional or not.

Returns:boolean

true if the second expression is optional; false if it is required

parameterExpressionBNFback to summary
public abstract String parameterExpressionBNF(int index)

Returns the BNF to be used to parse one of the encapsulated expression.

Parameters
index:int

The position of the encapsulated Expression that needs to be parsed within the parenthesis, which starts at position 0

Returns:String

The BNF to be used to parse one of the encapsulated expression

parseEncapsulatedExpressionback to summary
protected void parseEncapsulatedExpression(WordParser wordParser, int whitespaceCount, boolean tolerant)

Implements abstract org.eclipse.persistence.jpa.jpql.parser.AbstractEncapsulatedExpression.parseEncapsulatedExpression.

Doc from org.eclipse.persistence.jpa.jpql.parser.AbstractEncapsulatedExpression.parseEncapsulatedExpression.

Parses the encapsulated expression 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

whitespaceCount:int

The number of whitespace characters that were parsed after '('

tolerant:boolean

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

Annotations
@Override
removeEncapsulatedExpressionback to summary
protected void removeEncapsulatedExpression()

Implements abstract org.eclipse.persistence.jpa.jpql.parser.AbstractEncapsulatedExpression.removeEncapsulatedExpression.

Doc from org.eclipse.persistence.jpa.jpql.parser.AbstractEncapsulatedExpression.removeEncapsulatedExpression.

Removes the encapsulated Expression that was parsed, it should not be part of this one. This happens when the parsed information does not have both '(' and ')'.

Annotations
@Override
toParsedTextEncapsulatedExpressionback to summary
protected void toParsedTextEncapsulatedExpression(StringBuilder writer, boolean actual)

Implements abstract org.eclipse.persistence.jpa.jpql.parser.AbstractEncapsulatedExpression.toParsedTextEncapsulatedExpression.

Doc from org.eclipse.persistence.jpa.jpql.parser.AbstractEncapsulatedExpression.toParsedTextEncapsulatedExpression.

Generates a string representation of the encapsulated Expression.

Parameters
writer:StringBuilder

The buffer used to append the encapsulated Expression's string representation

actual:boolean

Determines whether to include any characters that are considered virtual, i.e. that was parsed when the query is incomplete and is needed for functionality like content assist

Annotations
@Override