Package org.eclipse.persistence.jpa.jpql
Class EclipseLinkGrammarValidator
java.lang.Object
org.eclipse.persistence.jpa.jpql.parser.AnonymousExpressionVisitor
org.eclipse.persistence.jpa.jpql.AbstractValidator
org.eclipse.persistence.jpa.jpql.AbstractGrammarValidator
org.eclipse.persistence.jpa.jpql.EclipseLinkGrammarValidator
- All Implemented Interfaces:
EclipseLinkExpressionVisitor
,ExpressionVisitor
public class EclipseLinkGrammarValidator
extends AbstractGrammarValidator
implements EclipseLinkExpressionVisitor
This validator adds EclipseLink extension over what the JPA functional specification had defined.
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.
- Since:
- 2.4
- Version:
- 2.5
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
protected static final class
Nested classes/interfaces inherited from class org.eclipse.persistence.jpa.jpql.AbstractGrammarValidator
AbstractGrammarValidator.AbstractCollectionValidator, AbstractGrammarValidator.AbstractDoubleEncapsulatedExpressionHelper<T extends AbstractDoubleEncapsulatedExpression>, AbstractGrammarValidator.AbstractEncapsulatedExpressionHelper<T extends AbstractEncapsulatedExpression>, AbstractGrammarValidator.AbstractSingleEncapsulatedExpressionHelper<T extends AbstractSingleEncapsulatedExpression>, AbstractGrammarValidator.AbstractTripleEncapsulatedExpressionHelper<T extends AbstractTripleEncapsulatedExpression>, AbstractGrammarValidator.CollectionExpressionVisitor, AbstractGrammarValidator.CollectionSeparatedByCommaValidator, AbstractGrammarValidator.CollectionSeparatedBySpaceValidator, AbstractGrammarValidator.ComparisonExpressionVisitor, AbstractGrammarValidator.DateTimeVisitor, AbstractGrammarValidator.NullExpressionVisitor
Nested classes/interfaces inherited from class org.eclipse.persistence.jpa.jpql.AbstractValidator
AbstractValidator.BypassChildCollectionExpressionVisitor, AbstractValidator.BypassParentSubExpressionVisitor, AbstractValidator.ChildrenCollectorVisitor, AbstractValidator.JPQLQueryBNFValidator, AbstractValidator.NestedArrayVisitor, AbstractValidator.OwningClauseVisitor, AbstractValidator.OwningStatementVisitor, AbstractValidator.SubqueryVisitor
-
Constructor Summary
ConstructorDescriptionEclipseLinkGrammarValidator
(JPQLGrammar jpqlGrammar) Creates a newEclipseLinkGrammarValidator
. -
Method Summary
Modifier and TypeMethodDescriptionprotected LiteralVisitor
Creates the visitor that can retrieve some information about various literal.protected AbstractValidator.OwningClauseVisitor
Creates the visitor that traverses the parent hierarchy of anyExpression
and stops at the firstExpression
that is a clause.Returns the visitor that traverses the parent hierarchy of anyExpression
and stops at the firstExpression
that is a clause.protected final boolean
Determines whether the persistence provider is EclipseLink or not.protected boolean
isInExpressionWithNestedArray
(SimpleSelectClause expression) Determines whether the subquery is part of anIN
expression where the left expression is a nested array.protected boolean
isInputParameterInValidLocation
(InputParameter expression) protected boolean
Determines whether aJOIN FETCH
expression can be identified by with an identification variable or not.protected boolean
Determines whether the given subquerySELECT
clause can return more than one item or just a single.protected boolean
isOwnedByInExpression
(Expression expression) protected boolean
isOwnedByUnionClause
(Expression expression) Determines whether the givenExpression
is a child of the UNION clause.protected boolean
Determines whether a subquery can be used in any clause of the top-level query.protected void
validateAbstractSelectClause
(AbstractSelectClause expression, boolean multipleSelectItemsAllowed) Validates the select expression of the givenSELECT
clause.void
visit
(AsOfClause expression) Visits theAsOfClause
expression.void
visit
(CastExpression expression) Visits theCastExpression
expression.void
visit
(ConnectByClause expression) Visits theConnectByClause
expression.void
visit
(DatabaseType expression) Visits theDatabaseType
expression.void
visit
(ExtractExpression expression) Visits theExtractExpression
expression.void
visit
(HierarchicalQueryClause expression) Visits theHierarchicalQueryClause
expression.void
visit
(OrderSiblingsByClause expression) Visits theOrderSiblingsByClause
expression.void
visit
(RegexpExpression expression) Visits theRegexpExpression
expression.void
visit
(StartWithClause expression) Visits theStartWithClause
expression.void
visit
(TableExpression expression) Visits theTableExpression
expression.void
visit
(TableVariableDeclaration expression) Visits theTableVariableDeclaration
expression.void
visit
(UnionClause expression) Visits theUnionClause
expression.Methods inherited from class org.eclipse.persistence.jpa.jpql.AbstractGrammarValidator
absExpressionHelper, allOrAnyExpressionHelper, avgFunctionHelper, buildAbsExpressionHelper, buildAllOrAnyExpressionHelper, buildAvgFunctionHelper, buildCoalesceExpressionHelper, buildCollectionExpressionVisitor, buildConcatExpressionHelper, buildCountFunctionHelper, buildDateTimeVisitor, buildEntryExpressionHelper, buildExistsExpressionHelper, buildFunctionExpressionHelper, buildIndexExpressionHelper, buildKeyExpressionHelper, buildLengthExpressionHelper, buildLocateExpressionHelper, buildLowerExpressionHelper, buildMaxFunctionHelper, buildMinFunctionHelper, buildModExpressionHelper, buildNullExpressionVisitor, buildNullIfExpressionHelper, buildObjectExpressionHelper, buildSizeExpressionHelper, buildSqrtExpressionHelper, buildSubstringExpressionHelper, buildSumFunctionHelper, buildTrimExpressionHelper, buildTypeExpressionHelper, buildUpperExpressionHelper, buildValueExpressionHelper, coalesceExpressionHelper, collectionSeparatedByCommaValidator, collectionSeparatedBySpaceValidator, comparisonExpressionVisitor, concatExpressionHelper, countFunctionHelper, dispose, entryExpressionHelper, existsExpressionHelper, functionExpressionHelper, getCollectionExpression, getCollectionExpressionVisitor, getDateTimeVisitor, getGrammar, getHelper, indexExpressionHelper, initialize, isChildOfComparisonExpession, isCollectionExpression, isDateTimeConstant, isJPA1_0, isJPA2_0, isJPA2_1, isNewerThan, isNewerThanOrEqual, isNumericLiteral, isOlderThan, isOlderThanOrEqual, isOwnedByConditionalClause, isOwnedByFromClause, isOwnedBySubFromClause, isValidJavaIdentifier, keyExpressionHelper, lengthExpressionHelper, locateExpressionHelper, lowerExpressionHelper, maxFunctionHelper, minFunctionHelper, modExpressionHelper, nullIfExpressionHelper, objectExpressionHelper, position, registerHelper, sizeExpressionHelper, sqrtExpressionHelper, substringExpressionHelper, sumFunctionHelper, trimExpressionHelper, typeExpressionHelper, upperExpressionHelper, validateAbstractConditionalClause, validateAbstractDoubleEncapsulatedExpression, validateAbstractFromClause, validateAbstractSelectStatement, validateAbstractSingleEncapsulatedExpression, validateAbstractTripleEncapsulatedExpression, validateAggregateFunctionLocation, validateArithmeticExpression, validateCollectionSeparatedByComma, validateCollectionSeparatedBySpace, validateCompoundExpression, validateIdentificationVariableDeclaration, validateIdentifier, validateInputParameters, validateJoins, validateLikeExpressionEscapeCharacter, validateLogicalExpression, validateOwningClause, validatePathExpression, validateSimpleSelectStatement, valueExpressionHelper, 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 org.eclipse.persistence.jpa.jpql.AbstractValidator
addProblem, addProblem, addProblem, addProblem, buildChildrenCollector, buildNestedArrayVisitor, buildOwningStatementVisitor, buildProblem, buildSubqueryVisitor, getBypassChildCollectionExpressionVisitor, getBypassParentSubExpressionVisitor, getChildren, getChildrenCollectorVisitor, getExpressionRegistry, getExpressionValidator, getJPAVersion, getJPQLQueryBNFValidator, getJPQLQueryBNFValidator, getLiteralVisitor, getNestedArrayVisitor, getOwningStatementVisitor, getProvider, getProviderVersion, getQueryBNF, getSubqueryVisitor, isNestedArray, isSubquery, isValid, isValid, isValid, isValidWithChildCollectionBypass, isWithinSubquery, isWithinTopLevelQuery, length, literal, nestedArraySize, position, problemsSize, setProblems, visit
Methods inherited from class org.eclipse.persistence.jpa.jpql.parser.AnonymousExpressionVisitor
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
Methods inherited from interface org.eclipse.persistence.jpa.jpql.parser.ExpressionVisitor
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, visit, visit, visit, visit, visit, visit, visit, visit, visit
-
Constructor Details
-
EclipseLinkGrammarValidator
Creates a newEclipseLinkGrammarValidator
.- Parameters:
jpqlGrammar
- TheJPQLGrammar
that defines how the JPQL query was parsed
-
-
Method Details
-
buildCastExpressionHelper
protected AbstractGrammarValidator.AbstractSingleEncapsulatedExpressionHelper<CastExpression> buildCastExpressionHelper() -
buildDatabaseTypeHelper
protected AbstractGrammarValidator.AbstractDoubleEncapsulatedExpressionHelper<DatabaseType> buildDatabaseTypeHelper() -
buildExtractExpressionHelper
protected AbstractGrammarValidator.AbstractSingleEncapsulatedExpressionHelper<ExtractExpression> buildExtractExpressionHelper() -
buildInExpressionVisitor
-
buildInExpressionWithNestedArrayVisitor
protected EclipseLinkGrammarValidator.InExpressionWithNestedArrayVisitor buildInExpressionWithNestedArrayVisitor() -
buildLiteralVisitor
Description copied from class:AbstractValidator
Creates the visitor that can retrieve some information about various literal.- Specified by:
buildLiteralVisitor
in classAbstractValidator
- Returns:
- A new
LiteralVisitor
-
buildOwningClauseVisitor
Description copied from class:AbstractValidator
Creates the visitor that traverses the parent hierarchy of anyExpression
and stops at the firstExpression
that is a clause.- Specified by:
buildOwningClauseVisitor
in classAbstractValidator
- Returns:
- A new
AbstractValidator.OwningClauseVisitor
-
buildTableExpressionHelper
protected AbstractGrammarValidator.AbstractSingleEncapsulatedExpressionHelper<TableExpression> buildTableExpressionHelper() -
castExpressionHelper
protected AbstractGrammarValidator.AbstractSingleEncapsulatedExpressionHelper<CastExpression> castExpressionHelper() -
databaseTypeHelper
protected AbstractGrammarValidator.AbstractDoubleEncapsulatedExpressionHelper<DatabaseType> databaseTypeHelper() -
extractExpressionHelper
protected AbstractGrammarValidator.AbstractSingleEncapsulatedExpressionHelper<ExtractExpression> extractExpressionHelper() -
getInExpressionVisitor
-
getInExpressionWithNestedArray
protected EclipseLinkGrammarValidator.InExpressionWithNestedArrayVisitor getInExpressionWithNestedArray() -
getOwningClauseVisitor
protected AbstractEclipseLinkSemanticValidator.EclipseLinkOwningClauseVisitor getOwningClauseVisitor()Description copied from class:AbstractValidator
Returns the visitor that traverses the parent hierarchy of anyExpression
and stops at the firstExpression
that is a clause.- Overrides:
getOwningClauseVisitor
in classAbstractValidator
- Returns:
AbstractValidator.OwningClauseVisitor
-
isEclipseLink
protected final boolean isEclipseLink()Determines whether the persistence provider is EclipseLink or not.- Returns:
true
if the persistence provider is EclipseLink;false
otherwise
-
isInExpressionWithNestedArray
Determines whether the subquery is part of anIN
expression where the left expression is a nested array.- Parameters:
expression
- TheSimpleSelectClause
of the subquery- Returns:
true
if the subquery is in anIN
expression and its left expression is a nested array
-
isInputParameterInValidLocation
- Overrides:
isInputParameterInValidLocation
in classAbstractGrammarValidator
-
isJoinFetchIdentifiable
protected boolean isJoinFetchIdentifiable()Description copied from class:AbstractGrammarValidator
Determines whether aJOIN FETCH
expression can be identified by with an identification variable or not.- Specified by:
isJoinFetchIdentifiable
in classAbstractGrammarValidator
- Returns:
true
if the expression can have an identification variable;false
otherwise
-
isMultipleSubquerySelectItemsAllowed
Description copied from class:AbstractGrammarValidator
Determines whether the given subquerySELECT
clause can return more than one item or just a single. By default, only one item can be returned.- Overrides:
isMultipleSubquerySelectItemsAllowed
in classAbstractGrammarValidator
- Parameters:
expression
- The subquerySELECT
clause- Returns:
true
if it can return more than one item;false
if it needs to return only one item
-
isOwnedByInExpression
-
isOwnedByUnionClause
Determines whether the givenExpression
is a child of the UNION clause.- Parameters:
expression
- TheExpression
to visit its parent hierarchy up to the clause- Returns:
true
if the first parent being a clause is the UNION clause;false
otherwise
-
isSubqueryAllowedAnywhere
protected boolean isSubqueryAllowedAnywhere()Description copied from class:AbstractGrammarValidator
Determines whether a subquery can be used in any clause of the top-level query.- Specified by:
isSubqueryAllowedAnywhere
in classAbstractGrammarValidator
- Returns:
true
if a subquery can be defined in any clause;false
if it can only be used within theWHERE
andHAVING
defined by the JPA 1.0 and 2.0 specification document
-
tableExpressionHelper
protected AbstractGrammarValidator.AbstractSingleEncapsulatedExpressionHelper<TableExpression> tableExpressionHelper() -
validateAbstractSelectClause
protected void validateAbstractSelectClause(AbstractSelectClause expression, boolean multipleSelectItemsAllowed) Description copied from class:AbstractGrammarValidator
Validates the select expression of the givenSELECT
clause. The select expression will only be visited if its JPQL query BNF is part of the select item BNF.- Overrides:
validateAbstractSelectClause
in classAbstractGrammarValidator
- Parameters:
expression
- TheAbstractSelectClause
to validatemultipleSelectItemsAllowed
- Determines whether theSELECT
can have one or more select expression or not
-
visit
Description copied from interface:EclipseLinkExpressionVisitor
Visits theAsOfClause
expression.- Specified by:
visit
in interfaceEclipseLinkExpressionVisitor
- Parameters:
expression
- TheExpression
to visit
-
visit
Description copied from interface:EclipseLinkExpressionVisitor
Visits theCastExpression
expression.- Specified by:
visit
in interfaceEclipseLinkExpressionVisitor
- Parameters:
expression
- TheExpression
to visit
-
visit
Description copied from interface:EclipseLinkExpressionVisitor
Visits theConnectByClause
expression.- Specified by:
visit
in interfaceEclipseLinkExpressionVisitor
- Parameters:
expression
- TheConnectByClause
to visit
-
visit
Description copied from interface:EclipseLinkExpressionVisitor
Visits theDatabaseType
expression.- Specified by:
visit
in interfaceEclipseLinkExpressionVisitor
- Parameters:
expression
- TheDatabaseType
to visit
-
visit
Description copied from interface:EclipseLinkExpressionVisitor
Visits theExtractExpression
expression.- Specified by:
visit
in interfaceEclipseLinkExpressionVisitor
- Parameters:
expression
- TheExpression
to visit
-
visit
Description copied from interface:EclipseLinkExpressionVisitor
Visits theHierarchicalQueryClause
expression.- Specified by:
visit
in interfaceEclipseLinkExpressionVisitor
- Parameters:
expression
- TheHierarchicalQueryClause
to visit
-
visit
Description copied from interface:EclipseLinkExpressionVisitor
Visits theOrderSiblingsByClause
expression.- Specified by:
visit
in interfaceEclipseLinkExpressionVisitor
- Parameters:
expression
- TheExpression
to visit
-
visit
Description copied from interface:EclipseLinkExpressionVisitor
Visits theRegexpExpression
expression.- Specified by:
visit
in interfaceEclipseLinkExpressionVisitor
- Parameters:
expression
- TheExpression
to visit
-
visit
Description copied from interface:EclipseLinkExpressionVisitor
Visits theStartWithClause
expression.- Specified by:
visit
in interfaceEclipseLinkExpressionVisitor
- Parameters:
expression
- TheStartWithClause
to visit
-
visit
Description copied from interface:EclipseLinkExpressionVisitor
Visits theTableExpression
expression.- Specified by:
visit
in interfaceEclipseLinkExpressionVisitor
- Parameters:
expression
- TheExpression
to visit
-
visit
Description copied from interface:EclipseLinkExpressionVisitor
Visits theTableVariableDeclaration
expression.- Specified by:
visit
in interfaceEclipseLinkExpressionVisitor
- Parameters:
expression
- TheExpression
to visit
-
visit
Description copied from interface:EclipseLinkExpressionVisitor
Visits theUnionClause
expression.- Specified by:
visit
in interfaceEclipseLinkExpressionVisitor
- Parameters:
expression
- TheExpression
to visit
-