EclipseLink 2.4.2, build 'v20130514-5956486' API Reference

org.eclipse.persistence.jpa.jpql
Class EclipseLinkGrammarValidator

java.lang.Object
  extended by org.eclipse.persistence.jpa.jpql.parser.AnonymousExpressionVisitor
      extended by org.eclipse.persistence.jpa.jpql.AbstractValidator
          extended by org.eclipse.persistence.jpa.jpql.AbstractGrammarValidator
              extended by 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.

Version:
2.4
Author:
Pascal Filion
Since:
2.4

Nested Class Summary
protected static class EclipseLinkGrammarValidator.EclipseLinkOwningClauseVisitor
           
protected static class EclipseLinkGrammarValidator.InExpressionVisitor
           
 
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.OwningClauseVisitor, AbstractValidator.OwningStatementVisitor, AbstractValidator.SubqueryVisitor
 
Constructor Summary
EclipseLinkGrammarValidator(JPQLGrammar jpqlGrammar)
          Creates a new EclipseLinkGrammarValidator.
EclipseLinkGrammarValidator(JPQLQueryContext queryContext)
          Deprecated. This constructor only exists for backward compatibility. JPQLQueryContext is no longer required, only JPQLGrammar
 
Method Summary
protected  AbstractGrammarValidator.AbstractSingleEncapsulatedExpressionHelper<CastExpression> buildCastExpressionHelper()
           
protected  AbstractGrammarValidator.AbstractDoubleEncapsulatedExpressionHelper<DatabaseType> buildDatabaseTypeHelper()
           
protected  AbstractGrammarValidator.AbstractSingleEncapsulatedExpressionHelper<ExtractExpression> buildExtractExpressionHelper()
           
protected  EclipseLinkGrammarValidator.InExpressionVisitor buildInExpressionVisitor()
           
protected  LiteralVisitor buildLiteralVisitor()
          Creates the visitor that can retrieve some information about various literal.
protected  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  AbstractGrammarValidator.AbstractSingleEncapsulatedExpressionHelper<TableExpression> buildTableExpressionHelper()
           
protected  AbstractGrammarValidator.AbstractSingleEncapsulatedExpressionHelper<CastExpression> castExpressionHelper()
           
protected  AbstractGrammarValidator.AbstractDoubleEncapsulatedExpressionHelper<DatabaseType> databaseTypeHelper()
           
protected  AbstractGrammarValidator.AbstractSingleEncapsulatedExpressionHelper<ExtractExpression> extractExpressionHelper()
           
protected  EclipseLinkGrammarValidator.InExpressionVisitor getInExpressionVisitor()
           
protected  EclipseLinkGrammarValidator.EclipseLinkOwningClauseVisitor getOwningClauseVisitor()
          Returns the visitor that traverses the parent hierarchy of any Expression and stops at the first Expression that is a clause.
protected  boolean isInputParameterInValidLocation(InputParameter expression)
          
protected  boolean isJoinFetchIdentifiable()
          Determines whether a JOIN FETCH expression can be identified by with an identification variable or not.
protected  boolean isOwnedByInExpression(Expression expression)
           
protected  boolean isOwnedByUnionClause(Expression expression)
          Determines whether the given Expression is a child of the UNION clause.
protected  boolean isSubqueryAllowedAnywhere()
          Determines whether a subquery can be used in any clause of the top-level query.
protected  AbstractGrammarValidator.AbstractSingleEncapsulatedExpressionHelper<TableExpression> tableExpressionHelper()
           
protected  void validateAbstractSelectClause(AbstractSelectClause expression, boolean multipleSelectItemsAllowed)
          Validates the select expression of the given SELECT clause.
 void visit(CastExpression expression)
          Visits the CastExpression expression.
 void visit(DatabaseType expression)
          Visits the DatabaseType expression.
 void visit(ExtractExpression expression)
          Visits the ExtractExpression expression.
 void visit(RegexpExpression expression)
          
 void visit(TableExpression expression)
          Visits the TableExpression expression.
 void visit(TableVariableDeclaration expression)
          Visits the TableVariableDeclaration expression.
 void visit(UnionClause expression)
          Visits the UnionClause 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, buildOwningStatementVisitor, buildProblem, buildSubqueryVisitor, getBypassChildCollectionExpressionVisitor, getBypassParentSubExpressionVisitor, getChildren, getChildrenCollectorVisitor, getExpressionRegistry, getExpressionValidator, getJPAVersion, getJPQLQueryBNFValidator, getJPQLQueryBNFValidator, getLiteralVisitor, getOwningStatementVisitor, getProviderVersion, getQueryBNF, getSubqueryVisitor, isSubquery, isValid, isValid, isValid, isValidWithChildCollectionBypass, isWithinSubquery, isWithinTopLevelQuery, length, literal, position, problemsSize, setProblems, 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
 

Constructor Detail

EclipseLinkGrammarValidator

public EclipseLinkGrammarValidator(JPQLGrammar jpqlGrammar)
Creates a new EclipseLinkGrammarValidator.

Parameters:
jpqlGrammar - The JPQLGrammar that defines how the JPQL query was parsed

EclipseLinkGrammarValidator

@Deprecated
public EclipseLinkGrammarValidator(JPQLQueryContext queryContext)
Deprecated. This constructor only exists for backward compatibility. JPQLQueryContext is no longer required, only JPQLGrammar

Creates a new EclipseLinkGrammarValidator.

Parameters:
queryContext - The context used to query information about the JPQL query
See Also:
EclipseLinkGrammarValidator(JPQLGrammar)
Method Detail

buildCastExpressionHelper

protected AbstractGrammarValidator.AbstractSingleEncapsulatedExpressionHelper<CastExpression> buildCastExpressionHelper()

buildDatabaseTypeHelper

protected AbstractGrammarValidator.AbstractDoubleEncapsulatedExpressionHelper<DatabaseType> buildDatabaseTypeHelper()

buildExtractExpressionHelper

protected AbstractGrammarValidator.AbstractSingleEncapsulatedExpressionHelper<ExtractExpression> buildExtractExpressionHelper()

buildInExpressionVisitor

protected EclipseLinkGrammarValidator.InExpressionVisitor buildInExpressionVisitor()

buildLiteralVisitor

protected LiteralVisitor buildLiteralVisitor()
Creates the visitor that can retrieve some information about various literal.

Specified by:
buildLiteralVisitor in class AbstractValidator
Returns:
A new LiteralVisitor

buildOwningClauseVisitor

protected AbstractValidator.OwningClauseVisitor buildOwningClauseVisitor()
Creates the visitor that traverses the parent hierarchy of any Expression and stops at the first Expression that is a clause.

Specified by:
buildOwningClauseVisitor in class AbstractValidator
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

protected EclipseLinkGrammarValidator.InExpressionVisitor getInExpressionVisitor()

getOwningClauseVisitor

protected EclipseLinkGrammarValidator.EclipseLinkOwningClauseVisitor getOwningClauseVisitor()
Returns the visitor that traverses the parent hierarchy of any Expression and stops at the first Expression that is a clause.

Overrides:
getOwningClauseVisitor in class AbstractValidator
Returns:
AbstractValidator.OwningClauseVisitor

isInputParameterInValidLocation

protected boolean isInputParameterInValidLocation(InputParameter expression)

Overrides:
isInputParameterInValidLocation in class AbstractGrammarValidator

isJoinFetchIdentifiable

protected boolean isJoinFetchIdentifiable()
Determines whether a JOIN FETCH expression can be identified by with an identification variable or not.

Specified by:
isJoinFetchIdentifiable in class AbstractGrammarValidator
Returns:
true if the expression can have an identification variable; false otherwise

isOwnedByInExpression

protected boolean isOwnedByInExpression(Expression expression)

isOwnedByUnionClause

protected boolean isOwnedByUnionClause(Expression expression)
Determines whether the given Expression is a child of the UNION clause.

Parameters:
expression - The Expression 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()
Determines whether a subquery can be used in any clause of the top-level query.

Specified by:
isSubqueryAllowedAnywhere in class AbstractGrammarValidator
Returns:
true if a subquery can be defined in any clause; false if it can only be used within the WHERE and HAVING 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)
Validates the select expression of the given SELECT clause. The select expression will only be visited if its JPQL query BNF is part of the select item BNF.

Overrides:
validateAbstractSelectClause in class AbstractGrammarValidator
Parameters:
expression - The AbstractSelectClause to validate
multipleSelectItemsAllowed - Determines whether the SELECT can have one or more select expression or not

visit

public void visit(CastExpression expression)
Visits the CastExpression expression.

Specified by:
visit in interface EclipseLinkExpressionVisitor
Parameters:
expression - The Expression to visit

visit

public void visit(DatabaseType expression)
Visits the DatabaseType expression.

Specified by:
visit in interface EclipseLinkExpressionVisitor
Parameters:
expression - The DatabaseType to visit

visit

public void visit(ExtractExpression expression)
Visits the ExtractExpression expression.

Specified by:
visit in interface EclipseLinkExpressionVisitor
Parameters:
expression - The Expression to visit

visit

public void visit(RegexpExpression expression)

Specified by:
visit in interface EclipseLinkExpressionVisitor

visit

public void visit(TableExpression expression)
Visits the TableExpression expression.

Specified by:
visit in interface EclipseLinkExpressionVisitor
Parameters:
expression - The Expression to visit

visit

public void visit(TableVariableDeclaration expression)
Visits the TableVariableDeclaration expression.

Specified by:
visit in interface EclipseLinkExpressionVisitor
Parameters:
expression - The Expression to visit

visit

public void visit(UnionClause expression)
Visits the UnionClause expression.

Specified by:
visit in interface EclipseLinkExpressionVisitor
Parameters:
expression - The Expression to visit

EclipseLink 2.4.2, build 'v20130514-5956486' API Reference