Interface Expression
- All Known Implementing Classes:
AbsExpression
,AbstractConditionalClause
,AbstractDoubleEncapsulatedExpression
,AbstractEncapsulatedExpression
,AbstractExpression
,AbstractFromClause
,AbstractOrderByClause
,AbstractPathExpression
,AbstractSchemaName
,AbstractSelectClause
,AbstractSelectStatement
,AbstractSingleEncapsulatedExpression
,AbstractTripleEncapsulatedExpression
,AdditionExpression
,AggregateFunction
,AllOrAnyExpression
,AndExpression
,ArithmeticExpression
,ArithmeticFactor
,AsOfClause
,AvgFunction
,BadExpression
,BetweenExpression
,CaseExpression
,CastExpression
,CoalesceExpression
,CollectionExpression
,CollectionMemberDeclaration
,CollectionMemberExpression
,CollectionValuedPathExpression
,ComparisonExpression
,CompoundExpression
,ConcatExpression
,ConnectByClause
,ConstructorExpression
,CountFunction
,DatabaseType
,DateTime
,DefaultStringExpression
,DeleteClause
,DeleteStatement
,DivisionExpression
,EmptyCollectionComparisonExpression
,EncapsulatedIdentificationVariableExpression
,EntityTypeLiteral
,EntryExpression
,ExistsExpression
,ExtractExpression
,FromClause
,FunctionExpression
,GroupByClause
,HavingClause
,HierarchicalQueryClause
,IdentificationVariable
,IdentificationVariableDeclaration
,IndexExpression
,InExpression
,InputParameter
,Join
,JPQLExpression
,KeyExpression
,KeywordExpression
,LengthExpression
,LikeExpression
,LocateExpression
,LogicalExpression
,LowerExpression
,MaxFunction
,MinFunction
,ModExpression
,MultiplicationExpression
,NotExpression
,NullComparisonExpression
,NullExpression
,NullIfExpression
,NumericLiteral
,ObjectExpression
,OnClause
,OrderByClause
,OrderByItem
,OrderSiblingsByClause
,OrExpression
,RangeVariableDeclaration
,RegexpExpression
,ResultVariable
,SelectClause
,SelectStatement
,SimpleFromClause
,SimpleSelectClause
,SimpleSelectStatement
,SizeExpression
,SqrtExpression
,StartWithClause
,StateFieldPathExpression
,StringLiteral
,SubExpression
,SubstringExpression
,SubtractionExpression
,SumFunction
,TableExpression
,TableVariableDeclaration
,TreatExpression
,TrimExpression
,TypeExpression
,UnionClause
,UnknownExpression
,UpdateClause
,UpdateItem
,UpdateStatement
,UpperExpression
,ValueExpression
,WhenClause
,WhereClause
public interface Expression
This is the root interface of the parsed tree representation of a JPQL query. The way a JPQL
query is parsed is based on the
JPQL grammar
used.
Provisional API: This interface is part of an interim API that is still under development and expected to change significantly before reaching stability. It is available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.
- Version:
- 2.5
- See Also:
- Author:
- Pascal Filion
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The constant for 'ABS'.static final String
The constant for 'ALL'.static final String
The constant for 'AND'.static final String
The constant for 'ANY'.static final String
The constant for 'AS'.static final String
The constant for 'AS OF'.static final String
The constant for 'ASC'.static final String
The constant for 'AVG'.static final String
The constant for 'BETWEEN'.static final String
The constant for 'BIT_LENGTH', which is an unused keyword.static final String
The constant for 'BOTH'.static final String
The constant for the identifier 'CASE'.static final String
The constant for the identifier 'CAST'.static final String
The constant for 'CHAR_LENGTH', which is an unused keyword.static final String
The constant for 'CHARACTER_LENGTH', which is an unused keyword.static final String
The constant for 'CLASS', which is an unused keyword.static final String
The constant for 'COALESCE'.static final String
The constant 'COLUMN', which is an EclipseLink specific identifier that was added in version 2.4.static final String
The constant for 'CONCAT'.static final String
The constant for 'CONNECT BY'.static final String
The constant for 'COUNT'.static final String
The constant for 'CURRENT_DATE'.static final String
The constant for 'CURRENT_DATE'.static final String
The constant for 'CURRENT_TIMESTAMP'.static final String
The constant for 'DELETE'.static final String
The constant for 'DELETE FROM'.static final String
The constant for 'DESC'.static final String
The constant for '<>'.static final String
The constant for 'DISTINCT'.static final String
The constant for the division sign '/'.static final String
The constant for the identifier 'ELSE'.static final String
The constant for 'EMPTY'.static final String
The constant for the identifier 'END'.static final String
The constant for 'ENTRY'.static final String
The constant for '='.static final String
The constant for 'ESCAPE'.static final String
The constant for 'EXCEPT'.static final String
The constant for 'EXISTS'.static final String
The constant for 'EXTRACT'.static final String
The constant for 'FALSE'.static final String
A constant for 'FETCH'.static final String
The constant for 'FIRST'.static final String
The constant for 'FROM'.static final String
The constant 'FUNC', which is an EclipseLink specific identifier that was added in version 2.1.static final String
The constant 'FUNCTION', part of JPA 2.1.static final String
The constant for '>'.static final String
The constant for '>='.static final String
The constant for 'GROUP BY'.static final String
The constant for 'HAVING'.static final String
The constant for 'IN'.static final String
The constant for 'INDEX'.static final String
The constant for 'INNER'.static final String
The constant for 'INNER JOIN'.static final String
The constant for 'INNER JOIN FETCH'.static final String
The constant for 'INTERSECT'.static final String
The constant for 'IS'.static final String
The constant for 'IS EMPTY'.static final String
The constant for 'IS NOT EMPTY'.static final String
The constant for 'IS NOT NULL'.static final String
The constant for 'IS NULL'.static final String
The constant for 'JOIN'.static final String
The constant for 'JOIN FETCH'.static final String
The constant for 'KEY'.static final String
The constant for 'LAST'.static final String
The constant for 'LEADING'.static final String
The constant for 'LEFT'.static final String
The constant for 'LEFT JOIN'.static final String
The constant for 'LEFT JOIN FETCH'.static final String
The constant for 'LEFT OUTER JOIN'.static final String
The constant for 'LEFT OUTER JOIN FETCH'.static final String
The constant for 'LENGTH'.static final String
The constant for 'LIKE'.static final String
The constant for 'LOCATE'.static final String
The constant for 'LOWER'.static final String
The constant for '<'.static final String
The constant for '<='.static final String
The constant for 'MAX'.static final String
The constant for 'MEMBER'.static final String
The constant for 'MEMBER OF'.static final String
The constant for 'MIN'.static final String
The constant for the minus sign '-'.static final String
The constant for 'MOD'.static final String
The constant for multiplication sign '*'.static final String
The constant for ':'.static final String
The constant for 'NEW'.static final String
The constant for 'NOT'.static final String
The constant for 'NOT BETWEEN'.static final String
The constant for '!='.static final String
The constant for 'NOT EXISTS'.static final String
The constant for 'NOT IN'.static final String
The constant for 'NOT LIKE'.static final String
The constant for 'NOT MEMBER'.static final String
The constant for 'NOT MEMBER OF'.static final String
The constant for 'NULL'.static final String
The constant for 'NULLIF'.static final String
The constant for 'NULLS'.static final String
The constant for 'NULLS FIRST'.static final String
The constant for 'NULLS LAST'.static final String
The constant for 'OBJECT'.static final String
The constant for 'OF'.static final String
The constant for 'ON', which is an EclipseLink specific identifier that was added in version 2.4.static final String
The constant 'OPERATOR', which is an EclipseLink specific identifier that was added in version 2.4.static final String
The constant for 'OR'.static final String
The constant for 'ORDER BY'.static final String
The constant for 'ORDER SIBLINGS BY'.static final String
The constant for 'OUTER'.static final String
The constant for for the plus sign '+'.static final String
The constant for 'POSITION', which is an unused keyword.static final String
The constant for '?'.static final String
The constant for single quote.static final String
The constant for 'REGEXP'.static final String
The constant for 'SCN'.static final String
The constant for 'SELECT'.static final String
The constant for 'SET'.static final String
The constant for 'SIZE'.static final String
The constant for 'SOME'.static final String
The constant 'SQL', which is an EclipseLink specific identifier that was added in version 2.4.static final String
The constant for 'SQRT'.static final String
The constant for 'WHERE'.static final String
The constant for 'SUBSTRING'.static final String
The constant for 'SUM'.static final String
The constant for 'TABLE'.static final String
The constant for 'THEN'.static final String
The constant for 'TIMESTAMP'.static final String
The constant for 'TRAILING'.static final String
The constant for 'TREAT', which is an EclipseLink specific identifier that was added in version 2.1.static final String
The constant for 'TRIM'.static final String
The constant for 'TRUE'.static final String
The constant for 'TYPE'.static final String
The constant for 'UNION'.static final String
The constant for 'UNKNOWN', which is an unused keyword.static final String
The constant for 'UPDATE'.static final String
The constant for 'UPPER'.static final String
The constant for 'VALUE'.static final String
The constant for the identifier 'WHEN'.static final String
The constant for 'WHERE'. -
Method Summary
Modifier and TypeMethodDescriptionvoid
accept
(ExpressionVisitor visitor) Visits thisExpression
by the givenvisitor
.void
acceptChildren
(ExpressionVisitor visitor) Visits the children of thisExpression
.children()
Returns the children of thisExpression
.findQueryBNF
(Expression expression) Retrieves theJPQLQueryBNF
that represents the fragment of thisExpression
that was used when parsing the givenExpression
.Returns theJPQLGrammar
that defines how the JPQL query was parsed.int
Returns the length of the string representation of thisExpression
, which is the length of the text generated bytoActualText()
.int
Returns the position of thisExpression
within its parent hierarchy.Returns the parent of thisExpression
.Returns the BNF of thisExpression
.getRoot()
Retrieves the root node of the parsed tree hierarchy.boolean
isAncestor
(Expression expression) Determines whether thisExpression
is a parent of the givenExpression
.Returns the list representing thisExpression
and its children.void
populatePosition
(QueryPosition queryPosition, int position) Retrieves theExpression
located at the given position using the actual query, which may have extra whitespace.Generates a string representation of thisExpression
, which needs to include any characters that are considered virtual, i.e.Returns a string representation of thisExpression
and its children.
-
Field Details
-
ABS
The constant for 'ABS'.- See Also:
-
ALL
The constant for 'ALL'.- See Also:
-
AND
The constant for 'AND'.- See Also:
-
ANY
The constant for 'ANY'.- See Also:
-
AS
The constant for 'AS'.- See Also:
-
AS_OF
The constant for 'AS OF'.- See Also:
-
ASC
The constant for 'ASC'.- See Also:
-
AVG
The constant for 'AVG'.- See Also:
-
BETWEEN
The constant for 'BETWEEN'.- See Also:
-
BIT_LENGTH
The constant for 'BIT_LENGTH', which is an unused keyword.- See Also:
-
BOTH
The constant for 'BOTH'.- See Also:
-
CASE
The constant for the identifier 'CASE'.- See Also:
-
CAST
The constant for the identifier 'CAST'.- See Also:
-
CHAR_LENGTH
The constant for 'CHAR_LENGTH', which is an unused keyword.- See Also:
-
CHARACTER_LENGTH
The constant for 'CHARACTER_LENGTH', which is an unused keyword.- See Also:
-
CLASS
The constant for 'CLASS', which is an unused keyword.- See Also:
-
COALESCE
The constant for 'COALESCE'.- See Also:
-
COLUMN
The constant 'COLUMN', which is an EclipseLink specific identifier that was added in version 2.4.- See Also:
-
CONCAT
The constant for 'CONCAT'.- See Also:
-
CONNECT_BY
The constant for 'CONNECT BY'.- See Also:
-
COUNT
The constant for 'COUNT'.- See Also:
-
CURRENT_DATE
The constant for 'CURRENT_DATE'.- See Also:
-
CURRENT_TIME
The constant for 'CURRENT_DATE'.- See Also:
-
CURRENT_TIMESTAMP
The constant for 'CURRENT_TIMESTAMP'.- See Also:
-
DELETE
The constant for 'DELETE'.- See Also:
-
DELETE_FROM
The constant for 'DELETE FROM'.- See Also:
-
DESC
The constant for 'DESC'.- See Also:
-
DIFFERENT
The constant for '<>'.- See Also:
-
DISTINCT
The constant for 'DISTINCT'.- See Also:
-
DIVISION
The constant for the division sign '/'.- See Also:
-
ELSE
The constant for the identifier 'ELSE'.- See Also:
-
EMPTY
The constant for 'EMPTY'.- See Also:
-
END
The constant for the identifier 'END'.- See Also:
-
ENTRY
The constant for 'ENTRY'.- See Also:
-
EQUAL
The constant for '='.- See Also:
-
ESCAPE
The constant for 'ESCAPE'.- See Also:
-
EXCEPT
The constant for 'EXCEPT'.- See Also:
-
EXISTS
The constant for 'EXISTS'.- See Also:
-
EXTRACT
The constant for 'EXTRACT'.- See Also:
-
FALSE
The constant for 'FALSE'.- See Also:
-
FETCH
A constant for 'FETCH'.- See Also:
-
FIRST
The constant for 'FIRST'.- See Also:
-
FROM
The constant for 'FROM'.- See Also:
-
FUNC
The constant 'FUNC', which is an EclipseLink specific identifier that was added in version 2.1.- See Also:
-
FUNCTION
The constant 'FUNCTION', part of JPA 2.1.- See Also:
-
GREATER_THAN
The constant for '>'.- See Also:
-
GREATER_THAN_OR_EQUAL
The constant for '>='.- See Also:
-
GROUP_BY
The constant for 'GROUP BY'.- See Also:
-
HAVING
The constant for 'HAVING'.- See Also:
-
IN
The constant for 'IN'.- See Also:
-
INDEX
The constant for 'INDEX'.- See Also:
-
INNER
The constant for 'INNER'.- See Also:
-
INNER_JOIN
The constant for 'INNER JOIN'.- See Also:
-
INNER_JOIN_FETCH
The constant for 'INNER JOIN FETCH'.- See Also:
-
INTERSECT
The constant for 'INTERSECT'.- See Also:
-
IS
The constant for 'IS'.- See Also:
-
IS_EMPTY
The constant for 'IS EMPTY'.- See Also:
-
IS_NOT_EMPTY
The constant for 'IS NOT EMPTY'.- See Also:
-
IS_NOT_NULL
The constant for 'IS NOT NULL'.- See Also:
-
IS_NULL
The constant for 'IS NULL'.- See Also:
-
JOIN
The constant for 'JOIN'.- See Also:
-
JOIN_FETCH
The constant for 'JOIN FETCH'.- See Also:
-
KEY
The constant for 'KEY'.- See Also:
-
LAST
The constant for 'LAST'.- See Also:
-
LEADING
The constant for 'LEADING'.- See Also:
-
LEFT
The constant for 'LEFT'.- See Also:
-
LEFT_JOIN
The constant for 'LEFT JOIN'.- See Also:
-
LEFT_JOIN_FETCH
The constant for 'LEFT JOIN FETCH'.- See Also:
-
LEFT_OUTER_JOIN
The constant for 'LEFT OUTER JOIN'.- See Also:
-
LEFT_OUTER_JOIN_FETCH
The constant for 'LEFT OUTER JOIN FETCH'.- See Also:
-
LENGTH
The constant for 'LENGTH'.- See Also:
-
LIKE
The constant for 'LIKE'.- See Also:
-
LOCATE
The constant for 'LOCATE'.- See Also:
-
LOWER
The constant for 'LOWER'.- See Also:
-
LOWER_THAN
The constant for '<'.- See Also:
-
LOWER_THAN_OR_EQUAL
The constant for '<='.- See Also:
-
MAX
The constant for 'MAX'.- See Also:
-
MEMBER
The constant for 'MEMBER'.- See Also:
-
MEMBER_OF
The constant for 'MEMBER OF'.- See Also:
-
MIN
The constant for 'MIN'.- See Also:
-
MINUS
The constant for the minus sign '-'.- See Also:
-
MOD
The constant for 'MOD'.- See Also:
-
MULTIPLICATION
The constant for multiplication sign '*'.- See Also:
-
NAMED_PARAMETER
The constant for ':'.- See Also:
-
NEW
The constant for 'NEW'.- See Also:
-
NOT
The constant for 'NOT'.- See Also:
-
NOT_BETWEEN
The constant for 'NOT BETWEEN'.- See Also:
-
NOT_EQUAL
The constant for '!='.- See Also:
-
NOT_EXISTS
The constant for 'NOT EXISTS'.- See Also:
-
NOT_IN
The constant for 'NOT IN'.- See Also:
-
NOT_LIKE
The constant for 'NOT LIKE'.- See Also:
-
NOT_MEMBER
The constant for 'NOT MEMBER'.- See Also:
-
NOT_MEMBER_OF
The constant for 'NOT MEMBER OF'.- See Also:
-
NULL
The constant for 'NULL'.- See Also:
-
NULLIF
The constant for 'NULLIF'.- See Also:
-
NULLS
The constant for 'NULLS'.- See Also:
-
NULLS_FIRST
The constant for 'NULLS FIRST'.- See Also:
-
NULLS_LAST
The constant for 'NULLS LAST'.- See Also:
-
OBJECT
The constant for 'OBJECT'.- See Also:
-
OF
The constant for 'OF'.- See Also:
-
ON
The constant for 'ON', which is an EclipseLink specific identifier that was added in version 2.4.- See Also:
-
OPERATOR
The constant 'OPERATOR', which is an EclipseLink specific identifier that was added in version 2.4.- See Also:
-
OR
The constant for 'OR'.- See Also:
-
ORDER_BY
The constant for 'ORDER BY'.- See Also:
-
ORDER_SIBLINGS_BY
The constant for 'ORDER SIBLINGS BY'.- See Also:
-
OUTER
The constant for 'OUTER'.- See Also:
-
PLUS
The constant for for the plus sign '+'.- See Also:
-
POSITION
The constant for 'POSITION', which is an unused keyword.- See Also:
-
POSITIONAL_PARAMETER
The constant for '?'.- See Also:
-
QUOTE
The constant for single quote.- See Also:
-
REGEXP
The constant for 'REGEXP'.- See Also:
-
SCN
The constant for 'SCN'.- See Also:
-
SELECT
The constant for 'SELECT'.- See Also:
-
SET
The constant for 'SET'.- See Also:
-
SIZE
The constant for 'SIZE'.- See Also:
-
SOME
The constant for 'SOME'.- See Also:
-
SQL
The constant 'SQL', which is an EclipseLink specific identifier that was added in version 2.4.- See Also:
-
SQRT
The constant for 'SQRT'.- See Also:
-
START_WITH
The constant for 'WHERE'.- See Also:
-
SUBSTRING
The constant for 'SUBSTRING'.- See Also:
-
SUM
The constant for 'SUM'.- See Also:
-
TABLE
The constant for 'TABLE'.- See Also:
-
THEN
The constant for 'THEN'.- See Also:
-
TIMESTAMP
The constant for 'TIMESTAMP'.- See Also:
-
TRAILING
The constant for 'TRAILING'.- See Also:
-
TREAT
The constant for 'TREAT', which is an EclipseLink specific identifier that was added in version 2.1.- See Also:
-
TRIM
The constant for 'TRIM'.- See Also:
-
TRUE
The constant for 'TRUE'.- See Also:
-
TYPE
The constant for 'TYPE'.- See Also:
-
UNION
The constant for 'UNION'.- See Also:
-
UNKNOWN
The constant for 'UNKNOWN', which is an unused keyword.- See Also:
-
UPDATE
The constant for 'UPDATE'.- See Also:
-
UPPER
The constant for 'UPPER'.- See Also:
-
VALUE
The constant for 'VALUE'.- See Also:
-
WHEN
The constant for the identifier 'WHEN'.- See Also:
-
WHERE
The constant for 'WHERE'.- See Also:
-
-
Method Details
-
accept
Visits thisExpression
by the givenvisitor
.- Parameters:
visitor
- TheExpressionVisitor
to visit this object
-
acceptChildren
Visits the children of thisExpression
. This method can be used to optimize traversing the children since a new list is not created every timechildren()
is called.This does not traverse the
Expression
sub-hierarchy, use a subclass ofAbstractTraverseChildrenVisitor
in order to traverse the entire sub-hierarchy.- Parameters:
visitor
- Thevisitor
to visit the children of this object.
-
children
ListIterable<Expression> children()Returns the children of thisExpression
.- Returns:
- The children of this
Expression
or an emptyListIterable
-
findQueryBNF
Retrieves theJPQLQueryBNF
that represents the fragment of thisExpression
that was used when parsing the givenExpression
.- Parameters:
expression
- TheExpression
that is a descendant of this one- Returns:
- The
JPQLQueryBNF
that was used to parse the given expression
-
getGrammar
JPQLGrammar getGrammar()Returns theJPQLGrammar
that defines how the JPQL query was parsed.- Returns:
- The
JPQLGrammar
that was used to parse thisExpression
-
getLength
int getLength()Returns the length of the string representation of thisExpression
, which is the length of the text generated bytoActualText()
.- Returns:
- The length of the string representation of this
Expression
-
getOffset
int getOffset()Returns the position of thisExpression
within its parent hierarchy.- Returns:
- The length of the string representation of what is coming before this object
-
getParent
Expression getParent()Returns the parent of thisExpression
.- Returns:
- The parent of this
Expression
, which is nevernull
except for the root of the tree
-
getQueryBNF
JPQLQueryBNF getQueryBNF()Returns the BNF of thisExpression
.- Returns:
- The
JPQLQueryBNF
, which represents the grammar of thisExpression
-
getRoot
JPQLExpression getRoot()Retrieves the root node of the parsed tree hierarchy.- Returns:
- The root of the
Expression
tree
-
isAncestor
Determines whether thisExpression
is a parent of the givenExpression
.- Parameters:
expression
- TheExpression
to verify its paternity with thisExpression
- Returns:
true
if thisExpression
is the same as the givenExpression
or one of its parent;false
otherwise
-
orderedChildren
ListIterable<Expression> orderedChildren()Returns the list representing thisExpression
and its children.- Returns:
- The
Expressions
representing thisExpression
-
populatePosition
Retrieves theExpression
located at the given position using the actual query, which may have extra whitespace.- Parameters:
position
- The array has one element and is the position of theExpression
to retrieve
-
toActualText
String toActualText()Generates a string representation of thisExpression
, which needs 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.- Returns:
- The string representation of this
Expression
-
toParsedText
String toParsedText()Returns a string representation of thisExpression
and its children. The expression should contain whitespace even if the beautified version would not have any. For instance, "SELECT e " should be returned wheretoParsedText()
would return "SELECT e".- Returns:
- The string representation of this
Expression
-