|
Oracle Fusion Middleware Java API Reference for Oracle TopLink 11g Release 1 (11.1.1) E28847-01 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
org.eclipse.persistence.jpa.internal.jpql.parser.StringExpression
org.eclipse.persistence.jpa.internal.jpql.parser.AbstractExpression
org.eclipse.persistence.jpa.internal.jpql.parser.JPQLExpression
public final class JPQLExpression
A JPQL expression is the parsed tree representation of a Java Persistence query. The parser supports version 1.0 and 2.0 of the JPA specification.
A JPQL statement may be either a SELECT statement, an UPDATE statement, or a DELETE FROM statement.
QL_statement ::= select_statement | update_statement | delete_statement
| Field Summary | |
|---|---|
private AbstractExpression |
queryStatementThe tree representation of the query. |
private boolean |
tolerantDetermines if the parsing system should be tolerant, meaning if it should try to parse invalid or incomplete queries. |
private AbstractExpression |
unknownEndingStatementIf the expression could not be fully parsed, meaning some unknown text is trailing the query, this will contain it. |
private IJPAVersion |
versionThe version of the JPQL to support, which is the version of the Java Persistence specification. |
| Fields inherited from class org.eclipse.persistence.jpa.internal.jpql.parser.AbstractExpression |
|---|
COMMA, DOT, DOUBLE_QUOTE, LEFT_CURLY_BRACKET, LEFT_PARENTHESIS, NOT_DEFINED, RIGHT_CURLY_BRACKET, RIGHT_PARENTHESIS, SINGLE_QUOTE, SPACE, UNDERSCORE |
| Constructor Summary | |
|---|---|
|
JPQLExpression(java.lang.CharSequence query, IJPAVersion version)Creates a new JPQLExpression, which is the root of the JPQL parsed tree. |
|
JPQLExpression(java.lang.CharSequence query, IJPAVersion version, boolean tolerant)Creates a new JPQLExpression, which is the root of the JPQL parsed tree. |
private |
JPQLExpression(IJPAVersion version, boolean tolerant)Creates a new JPQLExpression, which is the root of the JPQL parsed tree. |
| Method Summary | |
|---|---|
void |
accept(ExpressionVisitor visitor)Visits this Expression by the given visitor. |
void |
acceptChildren(ExpressionVisitor visitor)Visits the children of this Expression. |
(package private) void |
addChildrenTo(java.util.Collection<Expression> children)Adds the children of this Expression to the given collection. |
(package private) void |
addOrderedChildrenTo(java.util.List<StringExpression> children)Adds the StringExpressions representing this Expression. |
private SelectStatement |
addSelectStatement() |
QueryPosition |
buildPosition(java.lang.String actualQuery, int position)Creates an object where the Expression is the leaf at the given position. |
private AbstractExpression |
buildQueryStatement(WordParser wordParser) |
private void |
checkQuery(java.lang.CharSequence query) |
private void |
checkVersion(IJPAVersion version) |
Expression |
getExpression(java.lang.String actualQuery, int position)Returns the deepest Expression for the given position. |
IJPAVersion |
getJPAVersion()Returns the version of the Java Persistence to support. |
JPQLQueryBNF |
getQueryBNF()Returns the BNF of this Expression. |
Expression |
getQueryStatement()Returns the Expression representing the query, which is either a SELECT, a DELETE or an UPDATE clause. |
AbstractExpression |
getUnknownEndingStatement()Returns the Expression that may contain a portion of the query that could not be parsed, this happens when the query is either incomplete or malformed. |
IJPAVersion |
getVersion()Returns the version of the JPQL to support, which is the version of the Java Persistence specification. |
boolean |
hasQueryStatement()Determines whether a query was parsed. |
boolean |
hasUnknownEndingStatement()Determines whether the query that got parsed had some malformed or unknown information. |
(package private) boolean |
isTolerant()Determines if the parser is in tolerant mode or is in fast mode. |
(package private) void |
parse(WordParser wordParser, boolean tolerant)Parses the query by starting at the current position, which is part of the given WordParser. |
static Expression |
parseConditionalExpression(java.lang.String abstractSchemaName, java.lang.CharSequence conditionalExpression, IJPAVersion version, boolean tolerant)Creates a new Expression by parsing the string, which represents a conditional expression. |
(package private) void |
toParsedText(java.lang.StringBuilder writer, boolean includeVirtual)Generates a string representation of this Expression. |
| Methods inherited from class org.eclipse.persistence.jpa.internal.jpql.parser.AbstractExpression |
|---|
buildExpressionFromFallingBack, buildNullExpression, buildStringExpression, buildStringExpression, buildUnknownExpression, children, expressionFactory, expressionFactoryForIdentifier, findQueryBNF, getChildren, getParent, getRoot, getText, handleAggregate, identifierRole, identifiers, identifiers, identifierVersion, isAncestor, isIdentifier, isNull, isParsingComplete, isUnknown, isVirtual, orderedChildren, parse, parseSingleExpression, populatePosition, queryBNF, readdLeadingSpaces, rebuildActualText, rebuildParsedText, setParent, setText, shouldParseWithFactoryFirst, shouldSkipLiteral, toActualText, toParsedText, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private AbstractExpression queryStatement
private boolean tolerant
private AbstractExpression unknownEndingStatement
private IJPAVersion version
| Constructor Detail |
|---|
public JPQLExpression(java.lang.CharSequence query,
IJPAVersion version)
JPQLExpression, which is the root of the JPQL parsed tree.
query - The string representation of the JPQL query to parseversion - The version of the JPQL to support, which is the version of the Java Persistence specification
public JPQLExpression(java.lang.CharSequence query,
IJPAVersion version,
boolean tolerant)
JPQLExpression, which is the root of the JPQL parsed tree.
query - The string representation of the JPQL query to parseversion - The version of the JPQL to support, which is the version of the Java Persistence specificationtolerant - Determines if the parsing system should be tolerant, meaning if it should try to parse invalid or incomplete queriesprivate JPQLExpression(IJPAVersion version, boolean tolerant)
JPQLExpression, which is the root of the JPQL parsed tree.
version - The version of the JPQL to support, which is the version of the Java Persistence specificationtolerant - Determines if the parsing system should be tolerant, meaning if it should try to parse invalid or incomplete queries| Method Detail |
|---|
public static Expression parseConditionalExpression(java.lang.String abstractSchemaName, java.lang.CharSequence conditionalExpression, IJPAVersion version, boolean tolerant)
Expression by parsing the string, which represents a conditional expression.abstractSchemaName - The abstract schema name for which the identification variable "this" representsconditionalExpression - The string representation of the conditional expression to parseversion - The version of the JPQL to support, which is the version of the Java Persistence specificationtolerant - Determines whether the parsing system should be tolerant, meaning if it should try to parse invalid or incomplete queriesExpression representing the given conditional expressionpublic void accept(ExpressionVisitor visitor)
Expression by the given visitor.visitor - The visitor to visit this objectpublic void acceptChildren(ExpressionVisitor visitor)
Expression. This method can be used to optimize traversing the children since a new list is not created every time Expression.children() or Expression.getChildren() is called.
This does not traverse the Expression sub-hierarchy, use an subclass of AbstractTraverseChildrenVisitor in order to traverse the entire sub-hierarchy.
visitor - The visitor to visit the children of this object.void addChildrenTo(java.util.Collection<Expression> children)
Expression to the given collection.addChildrenTo in class AbstractExpressionchildren - The collection used to store the childrenvoid addOrderedChildrenTo(java.util.List<StringExpression> children)
StringExpressions representing this Expression.addOrderedChildrenTo in class AbstractExpressionchildren - The list used to store the string representation of this Expressionprivate SelectStatement addSelectStatement()
public QueryPosition buildPosition(java.lang.String actualQuery, int position)
Expression is the leaf at the given position.actualQuery - The actual query is a string representation of the query that may contain extra whitespaceposition - The position of the cursor in the actual query, which is used to retrieve the deepest Expression. The position will be adjusted to fit into the beautified version of the queryQueryPositionprivate AbstractExpression buildQueryStatement(WordParser wordParser)
private void checkQuery(java.lang.CharSequence query)
private void checkVersion(IJPAVersion version)
public Expression getExpression(java.lang.String actualQuery, int position)
Expression for the given position.actualQuery - The actual query is the text version of the query that may contain extra whitespace and different formatting than the trim down version generated by the parsed treeposition - The position in the actual query used to retrieve the ExpressionExpression located at the given position in the given querypublic IJPAVersion getJPAVersion()
getJPAVersion in class AbstractExpressionpublic JPQLQueryBNF getQueryBNF()
Expression.getQueryBNF in class AbstractExpressionJPQLQueryBNF, which represents the grammar of this Expressionpublic Expression getQueryStatement()
Expression representing the query, which is either a SELECT, a DELETE or an UPDATE clause.public AbstractExpression getUnknownEndingStatement()
Expression that may contain a portion of the query that could not be parsed, this happens when the query is either incomplete or malformed.public IJPAVersion getVersion()
public boolean hasQueryStatement()
true the query was parsed; false otherwisepublic boolean hasUnknownEndingStatement()
true if the query could not be parsed correctly because it is either incomplete or malformedboolean isTolerant()
isTolerant in class AbstractExpressiontrue if the parsing system should parse invalid or incomplete queries; false when the query is well-formed and validvoid parse(WordParser wordParser, boolean tolerant)
WordParser.parse in class AbstractExpressionwordParser - The text to parse based on the current position of the cursortolerant - Determines whether the parsing system should be tolerant, meaning if it should try to parse invalid or incomplete queries
void toParsedText(java.lang.StringBuilder writer,
boolean includeVirtual)
Expression.toParsedText in class AbstractExpressionwriter - The buffer used to append this Expression's string representationincludeVirtual - 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
|
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||