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

public final Class BetweenExpression

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

Used in conditional expression to determine whether the result of an expression falls within an inclusive range of values. Numeric, string and date expression can be evaluated in this way.
BNF: between_expression ::= arithmetic_expression [NOT] BETWEEN arithmetic_expression AND arithmetic_expression |
string_expression [NOT] BETWEEN string_expression AND string_expression |
datetime_expression [NOT] BETWEEN datetime_expression AND datetime_expression
Author
Pascal Filion
Since
2.3
Version
2.5

Field Summary

Modifier and TypeField and Description
private String
andIdentifier

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

private String
betweenIdentifier

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

private AbstractExpression
expression

The Expression to be tested for an inclusive range of values.

private boolean
hasSpaceAfterAnd

Determines whether a whitespace was found after AND.

private boolean
hasSpaceAfterBetween

Determines whether a whitespace was found after BETWEEN.

private boolean
hasSpaceAfterLowerBound

Determines whether a whitespace was found after the lower bound expression.

private AbstractExpression
lowerBoundExpression

The Expression representing the lower bound expression.

private String
notIdentifier

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

private AbstractExpression
upperBoundExpression

The Expression representing the upper bound 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
public
BetweenExpression(AbstractExpression
The parent of this expression
parent
,
AbstractExpression
The Expression that is tested to be inclusive in a range of values
expression
)

Creates a new BetweenExpression.

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 AND identifier that was actually parsed, or an empty string if it was not parsed
getActualAndIdentifier
()

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

public String

Returns:

The identifier that was actually parsed
getActualBetweenIdentifier
()

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 NOT identifier that was actually parsed, or an empty string if it was not parsed
getActualNotIdentifier
()

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

public String

Returns:

The unique identifier of the JPQL query BNF for the lower and upper bound expressions
getBoundExpressionQueryBNFId
()

Returns the unique identifier of the BNF for the lower and upper bound expressions.

public Expression

Returns:

The expression that was parsed representing the expression to be tested
getExpression
()

Returns the Expression representing the expression to be tested for a range of values.

public String

Returns:

Either BETWEEN or NOT BETWEEN
getIdentifier
()

Returns the identifier for this expression that may include NOT if it was parsed.

public Expression

Returns:

The expression that was parsed representing the lower bound expression
getLowerBoundExpression
()

Returns the Expression representing the lower bound expression.

public JPQLQueryBNF
public Expression

Returns:

The expression that was parsed representing the upper bound expression
getUpperBoundExpression
()

Returns the Expression representing the upper bound expression.

public boolean

Returns:

true if the identifier AND was parsed; false otherwise
hasAnd
()

Determines whether the identifier AND was part of the query.

protected boolean

Returns:

true if the identifier BETWEEN was parsed; false otherwise
hasBetween
()

Determines whether the identifier BETWEEN was part of the query.

public boolean

Returns:

true if the query has the expression before BETWEEN; false otherwise
hasExpression
()

Determines whether the expression before the identifier was parsed.

public boolean

Returns:

true if the query has the lower bound expression; false otherwise
hasLowerBoundExpression
()

Determines whether the lower bound expression was parsed.

public boolean

Returns:

true if the identifier NOT was parsed; false otherwise
hasNot
()

Determines whether the identifier NOT was part of the query.

public boolean

Returns:

true if there was a whitespace after AND; false otherwise
hasSpaceAfterAnd
()

Determines whether a whitespace was found after AND.

public boolean

Returns:

true if there was a whitespace after the BETWEEN; false otherwise
hasSpaceAfterBetween
()

Determines whether a whitespace was found after BETWEEN.

public boolean

Returns:

true if there was a whitespace after the lower bound expression; false otherwise
hasSpaceAfterLowerBound
()

Determines whether a whitespace was found after the lower bound expression.

public boolean

Returns:

true if the query has the upper bound expression; false otherwise
hasUpperBoundExpression
()

Determines whether the upper bound expression was parsed.

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.
Inherited from org.eclipse.persistence.jpa.jpql.parser.AbstractExpression:
acceptUnknownVisitoracceptUnknownVisitorbuildExpressionFromFallingBackbuildNullExpressionbuildStringExpressionbuildStringExpressionbuildUnknownExpressioncalculatePositionchildrenfindFallBackExpressionFactorygetExpressionFactorygetExpressionRegistrygetGrammargetIdentifierVersiongetJPAVersiongetLengthgetOffsetgetParentgetQueryBNFgetRootgetTexthandleAggregatehandleCollectionisAncestorisIdentifierisNullisTolerantisUnknownisVirtualorderedChildrenparseparseUsingExpressionFactorypopulatePositionrebuildActualTextrebuildParsedTextsetParentsetTextshouldParseWithFactoryFirstshouldSkipLiteraltoActualTexttoParsedTexttoString

Field Detail

andIdentifierback to summary
private String andIdentifier

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

betweenIdentifierback to summary
private String betweenIdentifier

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

expressionback to summary
private AbstractExpression expression

The Expression to be tested for an inclusive range of values.

hasSpaceAfterAndback to summary
private boolean hasSpaceAfterAnd

Determines whether a whitespace was found after AND.

hasSpaceAfterBetweenback to summary
private boolean hasSpaceAfterBetween

Determines whether a whitespace was found after BETWEEN.

hasSpaceAfterLowerBoundback to summary
private boolean hasSpaceAfterLowerBound

Determines whether a whitespace was found after the lower bound expression.

lowerBoundExpressionback to summary
private AbstractExpression lowerBoundExpression

The Expression representing the lower bound expression.

notIdentifierback to summary
private String notIdentifier

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

upperBoundExpressionback to summary
private AbstractExpression upperBoundExpression

The Expression representing the upper bound expression.

Constructor Detail

BetweenExpressionback to summary
public BetweenExpression(AbstractExpression parent, AbstractExpression expression)

Creates a new BetweenExpression.

Parameters
parent:AbstractExpression

The parent of this expression

expression:AbstractExpression

The Expression that is tested to be inclusive in a range of values

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
getActualAndIdentifierback to summary
public String getActualAndIdentifier()

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

Returns:String

The AND identifier that was actually parsed, or an empty string if it was not parsed

getActualBetweenIdentifierback to summary
public String getActualBetweenIdentifier()

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

Returns:String

The identifier that was actually parsed

getActualNotIdentifierback to summary
public String getActualNotIdentifier()

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

Returns:String

The NOT identifier that was actually parsed, or an empty string if it was not parsed

getBoundExpressionQueryBNFIdback to summary
public String getBoundExpressionQueryBNFId()

Returns the unique identifier of the BNF for the lower and upper bound expressions.

Returns:String

The unique identifier of the JPQL query BNF for the lower and upper bound expressions

getExpressionback to summary
public Expression getExpression()

Returns the Expression representing the expression to be tested for a range of values.

Returns:Expression

The expression that was parsed representing the expression to be tested

getIdentifierback to summary
public String getIdentifier()

Returns the identifier for this expression that may include NOT if it was parsed.

Returns:String

Either BETWEEN or NOT BETWEEN

getLowerBoundExpressionback to summary
public Expression getLowerBoundExpression()

Returns the Expression representing the lower bound expression.

Returns:Expression

The expression that was parsed representing the lower bound expression

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
getUpperBoundExpressionback to summary
public Expression getUpperBoundExpression()

Returns the Expression representing the upper bound expression.

Returns:Expression

The expression that was parsed representing the upper bound expression

hasAndback to summary
public boolean hasAnd()

Determines whether the identifier AND was part of the query.

Returns:boolean

true if the identifier AND was parsed; false otherwise

hasBetweenback to summary
protected boolean hasBetween()

Determines whether the identifier BETWEEN was part of the query.

Returns:boolean

true if the identifier BETWEEN was parsed; false otherwise

hasExpressionback to summary
public boolean hasExpression()

Determines whether the expression before the identifier was parsed.

Returns:boolean

true if the query has the expression before BETWEEN; false otherwise

hasLowerBoundExpressionback to summary
public boolean hasLowerBoundExpression()

Determines whether the lower bound expression was parsed.

Returns:boolean

true if the query has the lower bound expression; false otherwise

hasNotback to summary
public boolean hasNot()

Determines whether the identifier NOT was part of the query.

Returns:boolean

true if the identifier NOT was parsed; false otherwise

hasSpaceAfterAndback to summary
public boolean hasSpaceAfterAnd()

Determines whether a whitespace was found after AND.

Returns:boolean

true if there was a whitespace after AND; false otherwise

hasSpaceAfterBetweenback to summary
public boolean hasSpaceAfterBetween()

Determines whether a whitespace was found after BETWEEN.

Returns:boolean

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

hasSpaceAfterLowerBoundback to summary
public boolean hasSpaceAfterLowerBound()

Determines whether a whitespace was found after the lower bound expression.

Returns:boolean

true if there was a whitespace after the lower bound expression; false otherwise

hasUpperBoundExpressionback to summary
public boolean hasUpperBoundExpression()

Determines whether the upper bound expression was parsed.

Returns:boolean

true if the query has the upper bound expression; 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
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