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

public final Class ComparisonExpression

extends CompoundExpression
Class Inheritance
Imports
org.eclipse.persistence.jpa.jpql.WordParser

Only the values of like types are permitted to be compared. A type is like another type if they correspond to the same Java language type, or if one is a primitive Java language type and the other is the wrapped Java class type equivalent (e.g., int and Integer are like types in this sense).

There is one exception to this rule: it is valid to compare numeric values for which the rules of numeric promotion apply. Conditional expressions attempting to compare non-like type values are disallowed except for this numeric case.

Note that the arithmetic operators and comparison operators are permitted to be applied to state-fields and input parameters of the wrapped Java class equivalents to the primitive numeric Java types. Two entities of the same abstract schema type are equal if and only if they have the same primary key value. Only equality/inequality comparisons over enumeration constants are required to be supported.

JPA 1.0 - BNF:

comparison_expression ::= string_expression comparison_operator {string_expression | all_or_any_expression} |
                         boolean_expression {=|<>} {boolean_expression | all_or_any_expression} |
                         enum_expression {=|<>} {enum_expression | all_or_any_expression} |
                         datetime_expression comparison_operator {datetime_expression | all_or_any_expression} |
                         entity_expression {=|<>} {entity_expression | all_or_any_expression} |
                         arithmetic_expression comparison_operator {arithmetic_expression | all_or_any_expression}
JPA 2.0 - BNF:
comparison_expression ::= string_expression comparison_operator {string_expression | all_or_any_expression} |
                         boolean_expression {=|<>} {boolean_expression | all_or_any_expression} |
                         enum_expression {=|<>} {enum_expression | all_or_any_expression} |
                         datetime_expression comparison_operator {datetime_expression | all_or_any_expression} |
                         entity_expression {=|<>} {entity_expression | all_or_any_expression} |
                         arithmetic_expression comparison_operator {arithmetic_expression | all_or_any_expression} |
                         entity_type_expression {=|<>} entity_type_expression}
Author
Pascal Filion
Since
2.3
Version
2.5

Constructor Summary

AccessConstructor and Description
public
ComparisonExpression(AbstractExpression
The parent of this expression
parent
,
String
The comparator identifier
identifier
)

Creates a new ComparisonExpression.

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 String

Returns:

The operator comparing the two expressions
getComparisonOperator
()

Returns the comparison operator, which is either '=', '>', '>=', '<', '<=' or '<>'.

public String
getLeftExpressionQueryBNFId()

Implements abstract org.eclipse.persistence.jpa.jpql.parser.CompoundExpression.getLeftExpressionQueryBNFId.

Returns the unique identifier of the JPQLQueryBNF for the left expression.
public JPQLQueryBNF
public String
getRightExpressionQueryBNFId()

Implements abstract org.eclipse.persistence.jpa.jpql.parser.CompoundExpression.getRightExpressionQueryBNFId.

Returns the unique identifier of the JPQLQueryBNF for the right 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 String
parseIdentifier(WordParser
The WordParser containing the text to parse, which starts with the identifier
wordParser
)

Implements abstract org.eclipse.persistence.jpa.jpql.parser.CompoundExpression.parseIdentifier.

Parses the identifier of this expression.
Inherited from org.eclipse.persistence.jpa.jpql.parser.CompoundExpression:
acceptChildrenaddChildrenToaddOrderedChildrenTofindQueryBNFgetActualIdentifiergetIdentifiergetLeftExpressiongetRightExpressionhasLeftExpressionhasRightExpressionhasSpaceAfterIdentifierparsesetLeftExpressionsetRightExpressiontoParsedText

Constructor Detail

ComparisonExpressionback to summary
public ComparisonExpression(AbstractExpression parent, String identifier)

Creates a new ComparisonExpression.

Parameters
parent:AbstractExpression

The parent of this expression

identifier:String

The comparator identifier

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
getComparisonOperatorback to summary
public String getComparisonOperator()

Returns the comparison operator, which is either '=', '>', '>=', '<', '<=' or '<>'.

Returns:String

The operator comparing the two expressions

getLeftExpressionQueryBNFIdback to summary
public String getLeftExpressionQueryBNFId()

Implements abstract org.eclipse.persistence.jpa.jpql.parser.CompoundExpression.getLeftExpressionQueryBNFId.

Doc from org.eclipse.persistence.jpa.jpql.parser.CompoundExpression.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

Annotations
@Override
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
getRightExpressionQueryBNFIdback to summary
public String getRightExpressionQueryBNFId()

Implements abstract org.eclipse.persistence.jpa.jpql.parser.CompoundExpression.getRightExpressionQueryBNFId.

Doc from org.eclipse.persistence.jpa.jpql.parser.CompoundExpression.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

Annotations
@Override
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
parseIdentifierback to summary
protected String parseIdentifier(WordParser wordParser)

Implements abstract org.eclipse.persistence.jpa.jpql.parser.CompoundExpression.parseIdentifier.

Doc from org.eclipse.persistence.jpa.jpql.parser.CompoundExpression.parseIdentifier.

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

Annotations
@Override