|
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.AnonymousExpressionVisitor
org.eclipse.persistence.jpa.internal.jpql.AbstractVisitor
org.eclipse.persistence.jpa.internal.jpql.AbstractValidator
public abstract class AbstractValidator
The abstract definition of a validator, which provides helper methods and visitors.
GrammarValidator
, SemanticValidator
Nested Class Summary | |
---|---|
protected static class |
AbstractValidator.BypassChildCollectionExpressionVisitor This visitor is responsible to traverse the children of a CollectionExpression in order to properly validate the Expression . |
protected static class |
AbstractValidator.BypassParentSubExpressionVisitor This visitor is responsible to traverse the parent hierarchy and to skip SubExpression if it's a parent. |
private static class |
AbstractValidator.ChildrenCollectorVisitor This visitor gathers the children of a CollectionExpression or a single visited Expression . |
protected static class |
AbstractValidator.ExpressionValidator This visitor validates any Expression by checking its BNF against some BNFs. |
protected static class |
AbstractValidator.OwningClauseVisitor This visitor retrieves the clause owning the visited Expression . |
Field Summary | |
---|---|
private AbstractValidator.BypassChildCollectionExpressionVisitor |
bypassChildCollectionExpressionVisitor This visitor is responsible to traverse the children of a CollectionExpression in order to properly validate the Expression . |
private AbstractValidator.BypassParentSubExpressionVisitor |
bypassParentSubExpressionVisitor This visitor is responsible to traverse the parent hierarchy and to skip SubExpression if it's a parent. |
private AbstractValidator.ChildrenCollectorVisitor |
childrenCollectorVisitor This visitor gathers the children of a CollectionExpression or a single visited Expression . |
private AbstractValidator.OwningClauseVisitor |
owningClauseVisitor This visitor is responsible to traverse the parent hierarchy and to retrieve the owning clause of the Expression being visited. |
private java.util.List<JPQLQueryProblem> |
problems The list of QueryProblems describing grammatical and semantic issues found in the query. |
private java.util.Map<java.lang.String,AbstractValidator.ExpressionValidator> |
validators The ExpressionValidators mapped by the BNF IDs. |
Fields inherited from class org.eclipse.persistence.jpa.internal.jpql.AbstractVisitor |
---|
queryContext |
Constructor Summary | |
---|---|
protected |
AbstractValidator(JPQLQueryContext queryContext) Creates a new AbstractValidator . |
Method Summary | |
---|---|
protected void |
addProblem(Expression expression, int startIndex, int endIndex, java.lang.String messageKey, java.lang.String... messageArguments) Adds a new validation problem that was found in the given Expression . |
protected void |
addProblem(Expression expression, java.lang.String messageKey) Adds a new validation problem that was found in the given Expression . |
protected void |
addProblem(Expression expression, java.lang.String messageKey, java.lang.String... arguments) Adds a new validation problem that was found in the given Expression . |
protected AbstractValidator.ExpressionValidator |
buildExpressionValidator(java.lang.String... queryBNFs) |
private JPQLQueryProblem |
buildProblem(Expression expression, int startIndex, int endIndex, java.lang.String messageKey, java.lang.String... messageArguments) Creates a new validation problem that was found in the given Expression . |
protected AbstractValidator.BypassChildCollectionExpressionVisitor |
bypassChildCollectionExpressionVisitor() |
protected AbstractValidator.BypassParentSubExpressionVisitor |
bypassParentSubExpressionVisitor() |
private int |
calculatePosition(Expression expression, int position) |
protected java.util.Collection<Expression> |
children(Expression expression) Retrieves the children of the given Expression . |
private AbstractValidator.ChildrenCollectorVisitor |
childrenCollectorVisitor() |
void |
dispose() Disposes of the internal data. |
protected AbstractValidator.ExpressionValidator |
expressionValidator(java.lang.String queryBNF) |
protected void |
initialize() Initializes this class. |
protected AbstractValidator.ExpressionValidator |
internalOrderByItemBNFValidator(IPlatform platform) |
protected boolean |
isOwnedByConditionalClause(Expression expression) Determines whether the given Expression is a child of a conditional clause, i.e. |
protected boolean |
isOwnedByFromClause(Expression expression) Determines whether the given Expression is a child of the FROM clause of the top-level query. |
protected boolean |
isOwnedBySubFromClause(Expression expression) Determines whether the given Expression is a child of the FROM clause of a subquery. |
protected boolean |
isValid(Expression expression, java.lang.String queryBNF) Determines whether the given Expression part is an expression of the given query BNF. |
protected boolean |
isValidJavaIdentifier(java.lang.String variable) Determines whether the given variable is a valid Java identifier, which means it follows the Java specification. |
protected boolean |
isValidWithChildCollectionBypass(Expression expression, java.lang.String queryBNF) Determines whether the given Expression part is an expression of the given query BNF. |
protected boolean |
isValidWithFindQueryBNF(AbstractExpression expression, java.lang.String queryBNF) |
protected boolean |
isValidWithParentSubExpressionBypass(Expression expression, java.lang.String queryBNF) Determines whether the given Expression part is an expression of the given query BNF. |
protected int |
length(Expression expression) Returns the length of the string representation of the given Expression . |
protected AbstractValidator.OwningClauseVisitor |
owningClauseVisitor() Returns the visitor that traverses the parent hierarchy of any Expression and stop at the first Expression that is a clause. |
protected int |
position(Expression expression) Calculates the position of the given expression by calculating the length of what is before. |
void |
setProblems(java.util.List<JPQLQueryProblem> problems) Sets the list that will be used to store problems this validator will find in the JPQL query. |
protected void |
visit(Expression expression) Blindly visit the given Expression . |
Methods inherited from class org.eclipse.persistence.jpa.internal.jpql.AbstractVisitor |
---|
collectionExpression, embeddable, entity, getJPAVersion, getManagedType, getManagedType, getMapping, getProvider, getQuery, getQueryExpression, getResolver, getType, getType, getType, getTypeDeclaration, getTypeHelper, getTypeRepository, isEclipseLinkPlatform, isEmbeddable, isEntity, isJavaPlatform, isMappedSuperclass, isNull, mappedSuperclass |
Methods inherited from class org.eclipse.persistence.jpa.internal.jpql.parser.AnonymousExpressionVisitor |
---|
visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private AbstractValidator.BypassChildCollectionExpressionVisitor bypassChildCollectionExpressionVisitor
CollectionExpression
in order to properly validate the Expression
.private AbstractValidator.BypassParentSubExpressionVisitor bypassParentSubExpressionVisitor
SubExpression
if it's a parent.private AbstractValidator.ChildrenCollectorVisitor childrenCollectorVisitor
CollectionExpression
or a single visited Expression
.private AbstractValidator.OwningClauseVisitor owningClauseVisitor
Expression
being visited.private java.util.List<JPQLQueryProblem> problems
QueryProblems
describing grammatical and semantic issues found in the query.private java.util.Map<java.lang.String,AbstractValidator.ExpressionValidator> validators
ExpressionValidators
mapped by the BNF IDs.Constructor Detail |
---|
protected AbstractValidator(JPQLQueryContext queryContext)
AbstractValidator
.
queryContext
- The context used to query information about the queryMethod Detail |
---|
protected final void addProblem(Expression expression, int startIndex, int endIndex, java.lang.String messageKey, java.lang.String... messageArguments)
Expression
.expression
- The Expression
that is either not following the BNF grammar or that has semantic problemsstartIndex
- The position where the problem was encounteredendIndex
- The position where the problem ends, inclusivelymessageKey
- The key used to retrieve the localized message describing the problemmessageArguments
- The list of arguments that can be used to format the localized description of the problemprotected final void addProblem(Expression expression, java.lang.String messageKey)
Expression
. The start index is the position of the given Expression
within the JPQL query and the end index is the end position of the Expression
within the JPQL query.expression
- The Expression
that is either not following the BNF grammar or that has semantic problemsmessageKey
- The key used to retrieve the localized message describing the problemprotected final void addProblem(Expression expression, java.lang.String messageKey, java.lang.String... arguments)
Expression
. The start index is the position of the given Expression
within the JPQL query and the end index is the end position of the Expression
within the JPQL query.expression
- The Expression
that is either not following the BNF grammar or that has semantic problemsmessageKey
- The key used to retrieve the localized message describing the problemmessageArguments
- The list of arguments that can be used to format the localized description of the problemprotected final AbstractValidator.ExpressionValidator buildExpressionValidator(java.lang.String... queryBNFs)
private JPQLQueryProblem buildProblem(Expression expression, int startIndex, int endIndex, java.lang.String messageKey, java.lang.String... messageArguments)
Expression
.expression
- The Expression
that is either not following the BNF grammar or that has semantic problemsstartIndex
- The position where the problem was encounteredendIndex
- The position where the problem ends, inclusivelymessageKey
- The key used to retrieve the localized message describing the problemmessageArguments
- The list of arguments that can be used to format the localized description of the problemQueryProblem
describing a problemprotected final AbstractValidator.BypassChildCollectionExpressionVisitor bypassChildCollectionExpressionVisitor()
protected final AbstractValidator.BypassParentSubExpressionVisitor bypassParentSubExpressionVisitor()
private int calculatePosition(Expression expression, int position)
protected final java.util.Collection<Expression> children(Expression expression)
Expression
. If it only has one child and it's a CollectionExpression
, then its children will be added to the collection.expression
- The Expression
to visitExpression
private AbstractValidator.ChildrenCollectorVisitor childrenCollectorVisitor()
public void dispose()
dispose
in class AbstractVisitor
protected final AbstractValidator.ExpressionValidator expressionValidator(java.lang.String queryBNF)
protected void initialize()
initialize
in class AbstractVisitor
protected final AbstractValidator.ExpressionValidator internalOrderByItemBNFValidator(IPlatform platform)
protected final boolean isOwnedByConditionalClause(Expression expression)
Expression
is a child of a conditional clause, i.e. either owned by the WHERE or HAVING clause.expression
- The Expression
to visit its parent hierarchy up to the clausetrue
if the first parent being a clause is the WHERE or HAVING clause; false
otherwiseprotected final boolean isOwnedByFromClause(Expression expression)
Expression
is a child of the FROM clause of the top-level query.expression
- The Expression
to visit its parent hierarchy up to the clausetrue
if the first parent being a clause is the top-level FROM clause; false
otherwiseprotected final boolean isOwnedBySubFromClause(Expression expression)
Expression
is a child of the FROM clause of a subquery.expression
- The Expression
to visit its parent hierarchy up to the clausetrue
if the first parent being a clause is the FROM clause of a subquery; false
otherwiseprotected final boolean isValid(Expression expression, java.lang.String queryBNF)
Expression
part is an expression of the given query BNF.expression
- The Expression
to validate based on the query BNFtrue
if the Expression
part is a child of the given query BNF; false
otherwiseprotected final boolean isValidJavaIdentifier(java.lang.String variable)
variable
- The variable to validatetrue
if the given variable follows the Java identifier specification; false
otherwiseprotected final boolean isValidWithChildCollectionBypass(Expression expression, java.lang.String queryBNF)
Expression
part is an expression of the given query BNF. The CollectionExpression
that may be the direct child of the given Expression
will be bypassed.expression
- The Expression
to validate based on the query BNFtrue
if the Expression
part is a child of the given query BNF; false
otherwiseprotected final boolean isValidWithFindQueryBNF(AbstractExpression expression, java.lang.String queryBNF)
protected final boolean isValidWithParentSubExpressionBypass(Expression expression, java.lang.String queryBNF)
Expression
part is an expression of the given query BNF. The parent SubExpression
that may be the parent of the given Expression
will be bypassed.expression
- The Expression
to validate based on the query BNFtrue
if the Expression
part is a child of the given query BNF; false
otherwiseprotected final int length(Expression expression)
Expression
.expression
- The Expression
to retrieve the length of its stringExpression
protected final AbstractValidator.OwningClauseVisitor owningClauseVisitor()
Expression
and stop at the first Expression
that is a clause.AbstractValidator.OwningClauseVisitor
protected final int position(Expression expression)
expression
- The expression to determine its position within the parsed treepublic final void setProblems(java.util.List<JPQLQueryProblem> problems)
problems
this validator will find in the JPQL query.problems
- A non-null
list that will be used to store the problems
if any was foundprotected void visit(Expression expression)
Expression
.visit
in class AbstractVisitor
expression
- The Expression
to visit
|
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |