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

public abstract Class AbstractSingleEncapsulatedExpression

extends AbstractEncapsulatedExpression
Class Inheritance
Known Direct Subclasses
org.eclipse.persistence.jpa.jpql.parser.AggregateFunction, org.eclipse.persistence.jpa.jpql.parser.AllOrAnyExpression, org.eclipse.persistence.jpa.jpql.parser.CastExpression, org.eclipse.persistence.jpa.jpql.parser.CoalesceExpression, org.eclipse.persistence.jpa.jpql.parser.ConcatExpression, org.eclipse.persistence.jpa.jpql.parser.EncapsulatedIdentificationVariableExpression, org.eclipse.persistence.jpa.jpql.parser.ExistsExpression, org.eclipse.persistence.jpa.jpql.parser.ExtractExpression, org.eclipse.persistence.jpa.jpql.parser.FunctionExpression, org.eclipse.persistence.jpa.jpql.parser.LengthExpression, org.eclipse.persistence.jpa.jpql.parser.LowerExpression, org.eclipse.persistence.jpa.jpql.parser.MathSingleExpression, org.eclipse.persistence.jpa.jpql.parser.SizeExpression, org.eclipse.persistence.jpa.jpql.parser.SqrtExpression, org.eclipse.persistence.jpa.jpql.parser.SubExpression, org.eclipse.persistence.jpa.jpql.parser.TableExpression, org.eclipse.persistence.jpa.jpql.parser.TrimExpression, org.eclipse.persistence.jpa.jpql.parser.TypeExpression, org.eclipse.persistence.jpa.jpql.parser.UpperExpression, org.eclipse.persistence.jpa.jpql.parser.AbsExpression
Annotations
@SuppressWarnings:nls
Imports
java.util.Collection, .List, org.eclipse.persistence.jpa.jpql.Assert, .WordParser

This expression handles parsing a JPQL identifier followed by an expression encapsulated within parenthesis.
BNF: expression ::= <identifier>(expression)
Author
Pascal Filion
Since
2.3
Version
2.5

Field Summary

Modifier and TypeField and Description
private AbstractExpression
expression

The sub-expression encapsulated within parenthesis.

Constructor Summary

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

Creates a new EncapsulatedExpression.

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

Returns:

The BNF used to parse the encapsulated expression
getEncapsulatedExpressionQueryBNFId
()

Returns the BNF used to parse the encapsulated expression.

public final Expression

Returns:

The Expression that is encapsulated within parenthesis
getExpression
()

Returns the Expression that is encapsulated within parenthesis.

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 encapsulated expression was parsed; false if it was not parsed
hasExpression
()

Determines whether the encapsulated expression of the query was parsed.

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.
public final void
setExpression(AbstractExpression
The new encapsulated Expression, which cannot be null
expression
)

Manually sets the encapsulated Expression to become the given 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:
addOrderedChildrenToareLogicalIdentifiersSupportedgetActualIdentifiergetIdentifierhasLeftParenthesishasRightParenthesishasSpaceAfterIdentifierisParsingCompleteparseshouldParseRightParenthesistoParsedText

Field Detail

expressionback to summary
private AbstractExpression expression

The sub-expression encapsulated within parenthesis.

Constructor Detail

AbstractSingleEncapsulatedExpressionback to summary
protected AbstractSingleEncapsulatedExpression(AbstractExpression parent, String identifier)

Creates a new EncapsulatedExpression.

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 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
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
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
getEncapsulatedExpressionQueryBNFIdback to summary
public abstract String getEncapsulatedExpressionQueryBNFId()

Returns the BNF used to parse the encapsulated expression.

Returns:String

The BNF used to parse the encapsulated expression

getExpressionback to summary
public final Expression getExpression()

Returns the Expression that is encapsulated within parenthesis.

Returns:Expression

The Expression that is encapsulated within parenthesis

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
hasExpressionback to summary
public final boolean hasExpression()

Determines whether the encapsulated expression of the query was parsed.

Returns:boolean

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

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
setExpressionback to summary
public final void setExpression(AbstractExpression expression)

Manually sets the encapsulated Expression to become the given one.

Parameters
expression:AbstractExpression

The new encapsulated Expression, which cannot be null

Exceptions
NullPointerException:
The given AbstractExpression cannot be null
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