Class AbstractExpression
- java.lang.Object
-
- org.eclipse.persistence.jpa.jpql.parser.AbstractExpression
-
- All Implemented Interfaces:
Expression
- Direct Known Subclasses:
AbstractConditionalClause,AbstractEncapsulatedExpression,AbstractFromClause,AbstractOrderByClause,AbstractPathExpression,AbstractSchemaName,AbstractSelectClause,AbstractSelectStatement,ArithmeticFactor,AsOfClause,BadExpression,BetweenExpression,CaseExpression,CollectionExpression,CollectionMemberDeclaration,CollectionMemberExpression,CompoundExpression,ConnectByClause,ConstructorExpression,DateTime,DefaultStringExpression,DeleteClause,DeleteStatement,EmptyCollectionComparisonExpression,EntityTypeLiteral,GroupByClause,HierarchicalQueryClause,IdentificationVariable,IdentificationVariableDeclaration,InExpression,InputParameter,Join,JPQLExpression,KeywordExpression,LikeExpression,NotExpression,NullComparisonExpression,NullExpression,NumericLiteral,OrderByItem,RangeVariableDeclaration,RegexpExpression,ResultVariable,StringLiteral,TableVariableDeclaration,UnionClause,UnknownExpression,UpdateClause,UpdateItem,UpdateStatement,WhenClause
public abstract class AbstractExpression extends Object implements Expression
This is the abstract definition of all the parts used to create the tree hierarchy representing the parsed JPQL query.- Since:
- 2.3
- Version:
- 2.6
- Author:
- Pascal Filion
- See Also:
ExpressionFactory,JPQLGrammar
-
-
Field Summary
Fields Modifier and Type Field Description static charCOMMAThe constant for ','.static charDOTThe constant for '.'.static charDOUBLE_QUOTEThe constant for '"'.static charLEFT_CURLY_BRACKETThe constant for '{'.static charLEFT_PARENTHESISThe constant for '('.static charNOT_DEFINEDThe constant for a character that is not defined.static charRIGHT_CURLY_BRACKETThe constant for '}'.static charRIGHT_PARENTHESISThe constant for ')'.static charSINGLE_QUOTEThe constant for '''.static charSPACEThe constant for ' '.static charUNDERSCOREThe constant for '_'.-
Fields inherited from interface org.eclipse.persistence.jpa.jpql.parser.Expression
ABS, ALL, AND, ANY, AS, AS_OF, ASC, AVG, BETWEEN, BIT_LENGTH, BOTH, CASE, CAST, CHAR_LENGTH, CHARACTER_LENGTH, CLASS, COALESCE, COLUMN, CONCAT, CONNECT_BY, COUNT, CURRENT_DATE, CURRENT_TIME, CURRENT_TIMESTAMP, DELETE, DELETE_FROM, DESC, DIFFERENT, DISTINCT, DIVISION, ELSE, EMPTY, END, ENTRY, EQUAL, ESCAPE, EXCEPT, EXISTS, EXTRACT, FALSE, FETCH, FIRST, FROM, FUNC, FUNCTION, GREATER_THAN, GREATER_THAN_OR_EQUAL, GROUP_BY, HAVING, IN, INDEX, INNER, INNER_JOIN, INNER_JOIN_FETCH, INTERSECT, IS, IS_EMPTY, IS_NOT_EMPTY, IS_NOT_NULL, IS_NULL, JOIN, JOIN_FETCH, KEY, LAST, LEADING, LEFT, LEFT_JOIN, LEFT_JOIN_FETCH, LEFT_OUTER_JOIN, LEFT_OUTER_JOIN_FETCH, LENGTH, LIKE, LOCATE, LOWER, LOWER_THAN, LOWER_THAN_OR_EQUAL, MAX, MEMBER, MEMBER_OF, MIN, MINUS, MOD, MULTIPLICATION, NAMED_PARAMETER, NEW, NOT, NOT_BETWEEN, NOT_EQUAL, NOT_EXISTS, NOT_IN, NOT_LIKE, NOT_MEMBER, NOT_MEMBER_OF, NULL, NULLIF, NULLS, NULLS_FIRST, NULLS_LAST, OBJECT, OF, ON, OPERATOR, OR, ORDER_BY, ORDER_SIBLINGS_BY, OUTER, PLUS, POSITION, POSITIONAL_PARAMETER, QUOTE, REGEXP, SCN, SELECT, SET, SIZE, SOME, SQL, SQRT, START_WITH, SUBSTRING, SUM, TABLE, THEN, TIMESTAMP, TRAILING, TREAT, TRIM, TRUE, TYPE, UNION, UNKNOWN, UPDATE, UPPER, VALUE, WHEN, WHERE
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ListIterable<Expression>children()Returns the children of thisExpression.JPQLQueryBNFfindQueryBNF(Expression expression)Retrieves theJPQLQueryBNFthat represents the fragment of thisExpressionthat was used when parsing the givenExpression.JPQLGrammargetGrammar()Returns theJPQLGrammarthat defines how the JPQL query was parsed.JPAVersiongetIdentifierVersion(String identifier)Retrieves the JPA version in which the identifier was first introduced.intgetLength()Returns the length of the string representation of thisExpression, which is the length of the text generated byExpression.toActualText().intgetOffset()Returns the position of thisExpressionwithin its parent hierarchy.AbstractExpressiongetParent()Returns the parent of thisExpression.JPQLQueryBNFgetQueryBNF(String queryBNFID)Retrieves the BNF object that was registered for the given unique identifier.JPQLExpressiongetRoot()Retrieves the root node of the parsed tree hierarchy.booleanisAncestor(Expression expression)Determines whether thisExpressionis a parent of the givenExpression.ListIterable<Expression>orderedChildren()Returns the list representing thisExpressionand its children.voidpopulatePosition(QueryPosition queryPosition, int position)Retrieves theExpressionlocated at the given position using the actual query, which may have extra whitespace.StringtoActualText()Generates a string representation of thisExpression, which needs to include any characters that are considered virtual, i.e.StringtoParsedText()Returns a string representation of thisExpressionand its children.StringtoString()-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.persistence.jpa.jpql.parser.Expression
accept, acceptChildren, getQueryBNF
-
-
-
-
Field Detail
-
COMMA
public static final char COMMA
The constant for ','.- See Also:
- Constant Field Values
-
DOT
public static final char DOT
The constant for '.'.- See Also:
- Constant Field Values
-
DOUBLE_QUOTE
public static final char DOUBLE_QUOTE
The constant for '"'.- See Also:
- Constant Field Values
-
LEFT_CURLY_BRACKET
public static final char LEFT_CURLY_BRACKET
The constant for '{'.- See Also:
- Constant Field Values
-
LEFT_PARENTHESIS
public static final char LEFT_PARENTHESIS
The constant for '('.- See Also:
- Constant Field Values
-
NOT_DEFINED
public static final char NOT_DEFINED
The constant for a character that is not defined.- See Also:
- Constant Field Values
-
RIGHT_CURLY_BRACKET
public static final char RIGHT_CURLY_BRACKET
The constant for '}'.- See Also:
- Constant Field Values
-
RIGHT_PARENTHESIS
public static final char RIGHT_PARENTHESIS
The constant for ')'.- See Also:
- Constant Field Values
-
SINGLE_QUOTE
public static final char SINGLE_QUOTE
The constant for '''.- See Also:
- Constant Field Values
-
SPACE
public static final char SPACE
The constant for ' '.- See Also:
- Constant Field Values
-
UNDERSCORE
public static final char UNDERSCORE
The constant for '_'.- See Also:
- Constant Field Values
-
-
Method Detail
-
children
public final ListIterable<Expression> children()
Returns the children of thisExpression.- Specified by:
childrenin interfaceExpression- Returns:
- The children of this
Expressionor an emptyListIterable
-
findQueryBNF
public JPQLQueryBNF findQueryBNF(Expression expression)
Retrieves theJPQLQueryBNFthat represents the fragment of thisExpressionthat was used when parsing the givenExpression.- Specified by:
findQueryBNFin interfaceExpression- Parameters:
expression- TheExpressionthat is a descendant of this one- Returns:
- The
JPQLQueryBNFthat was used to parse the given expression
-
getGrammar
public JPQLGrammar getGrammar()
Returns theJPQLGrammarthat defines how the JPQL query was parsed.- Specified by:
getGrammarin interfaceExpression- Returns:
- The
JPQLGrammarthat was used to parse thisExpression
-
getIdentifierVersion
public JPAVersion getIdentifierVersion(String identifier)
Retrieves the JPA version in which the identifier was first introduced.- Returns:
- The version in which the identifier was introduced
-
getLength
public final int getLength()
Returns the length of the string representation of thisExpression, which is the length of the text generated byExpression.toActualText().- Specified by:
getLengthin interfaceExpression- Returns:
- The length of the string representation of this
Expression
-
getOffset
public final int getOffset()
Returns the position of thisExpressionwithin its parent hierarchy.- Specified by:
getOffsetin interfaceExpression- Returns:
- The length of the string representation of what is coming before this object
-
getParent
public final AbstractExpression getParent()
Returns the parent of thisExpression.- Specified by:
getParentin interfaceExpression- Returns:
- The parent of this
Expression, which is nevernullexcept for the root of the tree
-
getQueryBNF
public JPQLQueryBNF getQueryBNF(String queryBNFID)
Retrieves the BNF object that was registered for the given unique identifier.- Parameters:
queryBNFID- The unique identifier of theJPQLQueryBNFto retrieve- Returns:
- The
JPQLQueryBNFrepresenting a section of the grammar
-
getRoot
public final JPQLExpression getRoot()
Retrieves the root node of the parsed tree hierarchy.- Specified by:
getRootin interfaceExpression- Returns:
- The root of the
Expressiontree
-
isAncestor
public boolean isAncestor(Expression expression)
Determines whether thisExpressionis a parent of the givenExpression.- Specified by:
isAncestorin interfaceExpression- Parameters:
expression- TheExpressionto verify its paternity with thisExpression- Returns:
trueif thisExpressionis the same as the givenExpressionor one of its parent;falseotherwise
-
orderedChildren
public final ListIterable<Expression> orderedChildren()
Returns the list representing thisExpressionand its children.- Specified by:
orderedChildrenin interfaceExpression- Returns:
- The
Expressionsrepresenting thisExpression
-
populatePosition
public void populatePosition(QueryPosition queryPosition, int position)
Retrieves theExpressionlocated at the given position using the actual query, which may have extra whitespace.- Specified by:
populatePositionin interfaceExpressionposition- The array has one element and is the position of theExpressionto retrieve
-
toActualText
public 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.- Specified by:
toActualTextin interfaceExpression- Returns:
- The string representation of this
Expression
-
toParsedText
public String toParsedText()
Returns a string representation of thisExpressionand its children. The expression should contain whitespace even if the beautified version would not have any. For instance, "SELECT e " should be returned whereExpression.toParsedText()would return "SELECT e".- Specified by:
toParsedTextin interfaceExpression- Returns:
- The string representation of this
Expression
-
-