|
EclipseLink 2.4.2, build 'v20130514-5956486' API Reference | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.eclipse.persistence.jpa.jpql.parser.AnonymousExpressionVisitor
org.eclipse.persistence.jpa.jpql.AbstractValidator
public abstract class AbstractValidator
The abstract definition of a validator, which provides helper methods and visitors.
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.
AbstractGrammarValidator,
AbstractSemanticValidator| 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. |
protected static class |
AbstractValidator.ChildrenCollectorVisitor
This visitor gathers the children of a CollectionExpression or a single visited
Expression. |
static class |
AbstractValidator.JPQLQueryBNFValidator
This visitor validates any Expression by checking its BNF against some BNFs. |
static class |
AbstractValidator.OwningClauseVisitor
This visitor retrieves the clause owning the visited Expression. |
protected static class |
AbstractValidator.OwningStatementVisitor
This visitor retrieves the statement owning the visited Expression. |
protected static class |
AbstractValidator.SubqueryVisitor
This visitor retrieves the statement owning the visited Expression. |
| Constructor Summary | |
|---|---|
protected |
AbstractValidator()
Creates a new AbstractValidator. |
| Method Summary | |
|---|---|
protected void |
addProblem(Expression expression,
int startPosition,
int endPosition,
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,
int startPosition,
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.ChildrenCollectorVisitor |
buildChildrenCollector()
|
protected abstract LiteralVisitor |
buildLiteralVisitor()
Creates the visitor that can retrieve some information about various literal. |
protected abstract AbstractValidator.OwningClauseVisitor |
buildOwningClauseVisitor()
Creates the visitor that traverses the parent hierarchy of any Expression and stops at
the first Expression that is a clause. |
protected AbstractValidator.OwningStatementVisitor |
buildOwningStatementVisitor()
Creates the visitor that traverses the parent hierarchy of any Expression and stops at
the first Expression that is a statement. |
protected JPQLQueryProblem |
buildProblem(Expression expression,
int startPosition,
int endPosition,
java.lang.String messageKey,
java.lang.String... messageArguments)
Creates a new validation problem that was found in the given Expression. |
protected AbstractValidator.SubqueryVisitor |
buildSubqueryVisitor()
Creates the visitor that checks if the visited expression is a subquery or not.. |
void |
dispose()
Disposes this visitor. |
protected AbstractValidator.BypassChildCollectionExpressionVisitor |
getBypassChildCollectionExpressionVisitor()
|
protected AbstractValidator.BypassParentSubExpressionVisitor |
getBypassParentSubExpressionVisitor()
|
protected java.util.List<Expression> |
getChildren(Expression expression)
Returns a list containing either the given Expression if it's not a CollectionExpression or the children of the given CollectionExpression. |
protected AbstractValidator.ChildrenCollectorVisitor |
getChildrenCollectorVisitor()
|
protected ExpressionRegistry |
getExpressionRegistry()
Returns the registry containing the JPQLQueryBNFs and the ExpressionFactories that are used
to properly parse a JPQL query. |
protected AbstractValidator.JPQLQueryBNFValidator |
getExpressionValidator(java.lang.String queryBNF)
|
protected abstract JPQLGrammar |
getGrammar()
Returns the JPQLGrammar that defines how the JPQL query was parsed. |
protected JPAVersion |
getJPAVersion()
Returns the version of the Java Persistence this entity for which it was defined. |
protected AbstractValidator.JPQLQueryBNFValidator |
getJPQLQueryBNFValidator(JPQLQueryBNF queryBNF)
Returns the AbstractValidator.JPQLQueryBNFValidator that can be used to validate an Expression
by making sure its BNF is part of the given BNF. |
protected AbstractValidator.JPQLQueryBNFValidator |
getJPQLQueryBNFValidator(java.lang.String queryBNF)
Returns the AbstractValidator.JPQLQueryBNFValidator that can be used to validate an Expression
by making sure its BNF is part of the given BNF. |
protected LiteralVisitor |
getLiteralVisitor()
Returns the visitor that can retrieve some information about various literal. |
protected AbstractValidator.OwningClauseVisitor |
getOwningClauseVisitor()
Returns the visitor that traverses the parent hierarchy of any Expression and stops at
the first Expression that is a clause. |
protected AbstractValidator.OwningStatementVisitor |
getOwningStatementVisitor()
Returns the visitor that traverses the parent hierarchy of any Expression and stops at
the first Expression that is a statement. |
protected java.lang.String |
getProviderVersion()
Returns the version of the persistence provider. |
protected JPQLQueryBNF |
getQueryBNF(java.lang.String queryBNFId)
Retrieves the BNF object that was registered for the given unique identifier. |
protected AbstractValidator.SubqueryVisitor |
getSubqueryVisitor()
Returns the visitor that checks if the visited expression is a subquery or not. |
protected void |
initialize()
Initializes this validator. |
protected boolean |
isSubquery(Expression expression)
Determines whether the given Expression is a subquery. |
protected boolean |
isValid(Expression expression,
JPQLQueryBNF queryBNF)
Determines whether the given Expression is valid by checking its JPQLQueryBNF
with the given JPQLQueryBNF. |
protected boolean |
isValid(Expression expression,
java.lang.String... queryBNFIds)
Determines whether the given Expression is valid by checking its JPQLQueryBNF
with the list of JPQLQueryBNF associated with the given unique identifiers. |
protected boolean |
isValid(Expression expression,
java.lang.String queryBNFId)
Determines whether the given Expression is valid by checking its JPQLQueryBNF
with the JPQLQueryBNF associated with the given unique identifier. |
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 |
isWithinSubquery(Expression expression)
Determines whether the given Expression is part of a subquery. |
protected boolean |
isWithinTopLevelQuery(Expression expression)
Determines whether the given Expression is part of the top-level query. |
protected int |
length(Expression expression)
Returns the length of the string representation of the given Expression. |
protected java.lang.String |
literal(Expression expression,
LiteralType type)
Retrieves the "literal" from the given Expression. |
protected int |
position(Expression expression)
Calculates the position of the given expression by calculating the length of what is before. |
int |
problemsSize()
Returns the current number of problems that were registered during validation. |
void |
setProblems(java.util.Collection<JPQLQueryProblem> problems)
Sets the collection 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.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 |
| Constructor Detail |
|---|
protected AbstractValidator()
AbstractValidator.
| Method Detail |
|---|
protected void addProblem(Expression expression,
int startPosition,
int endPosition,
java.lang.String messageKey,
java.lang.String... messageArguments)
Expression.
expression - The Expression that is either not following the BNF grammar or that
has semantic problemsstartPosition - The position where the problem was encounteredendPosition - 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 problem
protected void addProblem(Expression expression,
int startPosition,
java.lang.String messageKey,
java.lang.String... messageArguments)
Expression.
expression - The Expression that is either not following the BNF grammar or that
has semantic problemsstartPosition - The position where the problem was encounteredmessageKey - 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 problem
protected 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 problem
protected 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 problemarguments - The list of arguments that can be used to format the localized description of
the problemprotected AbstractValidator.ChildrenCollectorVisitor buildChildrenCollector()
protected abstract LiteralVisitor buildLiteralVisitor()
LiteralVisitorprotected abstract AbstractValidator.OwningClauseVisitor buildOwningClauseVisitor()
Expression and stops at
the first Expression that is a clause.
AbstractValidator.OwningClauseVisitorprotected AbstractValidator.OwningStatementVisitor buildOwningStatementVisitor()
Expression and stops at
the first Expression that is a statement.
AbstractValidator.OwningStatementVisitor
protected JPQLQueryProblem buildProblem(Expression expression,
int startPosition,
int endPosition,
java.lang.String messageKey,
java.lang.String... messageArguments)
Expression.
expression - The Expression that is either not following the BNF grammar or that
has semantic problemsstartPosition - The position where the problem was encounteredendPosition - 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 problem
JPQLQueryProblem describing a problemprotected AbstractValidator.SubqueryVisitor buildSubqueryVisitor()
AbstractValidator.SubqueryVisitorpublic void dispose()
protected AbstractValidator.BypassChildCollectionExpressionVisitor getBypassChildCollectionExpressionVisitor()
protected AbstractValidator.BypassParentSubExpressionVisitor getBypassParentSubExpressionVisitor()
protected java.util.List<Expression> getChildren(Expression expression)
Expression if it's not a CollectionExpression or the children of the given CollectionExpression.
expression - The Expression to visit
Expression or the children of CollectionExpressionprotected AbstractValidator.ChildrenCollectorVisitor getChildrenCollectorVisitor()
protected ExpressionRegistry getExpressionRegistry()
JPQLQueryBNFs and the ExpressionFactories that are used
to properly parse a JPQL query.
protected AbstractValidator.JPQLQueryBNFValidator getExpressionValidator(java.lang.String queryBNF)
protected abstract JPQLGrammar getGrammar()
JPQLGrammar that defines how the JPQL query was parsed.
JPQLGrammar that was used to parse the JPQL queryprotected JPAVersion getJPAVersion()
protected AbstractValidator.JPQLQueryBNFValidator getJPQLQueryBNFValidator(JPQLQueryBNF queryBNF)
AbstractValidator.JPQLQueryBNFValidator that can be used to validate an Expression
by making sure its BNF is part of the given BNF.
queryBNF - The BNF used to determine the validity of an Expression
AbstractValidator.JPQLQueryBNFValidator that can determine if an Expression follows
the given BNFprotected AbstractValidator.JPQLQueryBNFValidator getJPQLQueryBNFValidator(java.lang.String queryBNF)
AbstractValidator.JPQLQueryBNFValidator that can be used to validate an Expression
by making sure its BNF is part of the given BNF.
queryBNF - The BNF used to determine the validity of an Expression
AbstractValidator.JPQLQueryBNFValidator that can determine if an Expression follows
the given BNFprotected LiteralVisitor getLiteralVisitor()
LiteralVisitorprotected AbstractValidator.OwningClauseVisitor getOwningClauseVisitor()
Expression and stops at
the first Expression that is a clause.
AbstractValidator.OwningClauseVisitorprotected AbstractValidator.OwningStatementVisitor getOwningStatementVisitor()
Expression and stops at
the first Expression that is a statement.
AbstractValidator.OwningStatementVisitorprotected java.lang.String getProviderVersion()
protected JPQLQueryBNF getQueryBNF(java.lang.String queryBNFId)
queryBNFId - The unique identifier of the JPQLQueryBNF to retrieve
JPQLQueryBNF representing a section of the grammarprotected AbstractValidator.SubqueryVisitor getSubqueryVisitor()
AbstractValidator.SubqueryVisitorprotected void initialize()
protected boolean isSubquery(Expression expression)
Expression is a subquery.
expression - The Expression to check its type
true if the given Expression is a subquery; false otherwise
protected boolean isValid(Expression expression,
JPQLQueryBNF queryBNF)
Expression is valid by checking its JPQLQueryBNF
with the given JPQLQueryBNF.
expression - The Expression to validate based on the query BNFqueryBNF - The JPQLQueryBNF that determines if the given Expression is valid
true if the Expression's JPQLQueryBNF is either the
JPQLQueryBNF or a child of it; false otherwise
protected boolean isValid(Expression expression,
java.lang.String queryBNFId)
Expression is valid by checking its JPQLQueryBNF
with the JPQLQueryBNF associated with the given unique identifier.
expression - The Expression to validate based on the query BNFqueryBNFId - The unique identifier of the JPQLQueryBNF that determines if the
given Expression is valid
true if the Expression's JPQLQueryBNF is either the
JPQLQueryBNF or a child of it; false otherwise
protected boolean isValid(Expression expression,
java.lang.String... queryBNFIds)
Expression is valid by checking its JPQLQueryBNF
with the list of JPQLQueryBNF associated with the given unique identifiers.
expression - The Expression to validate based on the query BNFqueryBNFId - The unique identifier of the JPQLQueryBNF that determines if the
given Expression is valid
true if the Expression's JPQLQueryBNF is either the
JPQLQueryBNF or a child of it; false otherwise
protected 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 BNF
true if the Expression part is a child of the given query BNF;
false otherwiseprotected boolean isWithinSubquery(Expression expression)
Expression is part of a subquery.
expression - The Expression to start scanning its location
true if the given Expression is part of a subquery; false
if it's part of the top-level queryprotected boolean isWithinTopLevelQuery(Expression expression)
Expression is part of the top-level query.
expression - The Expression to start scanning its location
true if the given Expression is part of the top-level query;
false if it's part of a subqueryprotected int length(Expression expression)
Expression.
expression - The Expression to retrieve the length of its string
Expression
protected java.lang.String literal(Expression expression,
LiteralType type)
Expression. The literal to retrieve depends on
the given type. The literal is basically a string value like an
identification variable name, an input parameter, a path expression, an abstract schema name,
etc.
expression - The Expression to visittype - The LiteralType helps to determine what to retrieve from the visited
Expression
Expression or an empty string if the given Expression and the LiteralType do not matchprotected int position(Expression expression)
expression - The expression to determine its position within the parsed tree
public final int problemsSize()
public void setProblems(java.util.Collection<JPQLQueryProblem> problems)
problems this
validator will find in the JPQL query.
problems - A non-null collection that will be used to store the problems if any was found
java.lang.NullPointerException - The Collection cannot be nullprotected void visit(Expression expression)
Expression.
visit in class AnonymousExpressionVisitorexpression - The Expression to visit
|
EclipseLink 2.4.2, build 'v20130514-5956486' API Reference | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||