public class AbstractEclipseLinkSemanticValidator extends AbstractSemanticValidator implements EclipseLinkExpressionVisitor
For instance, the function AVG accepts a state field path. The property it represents has
to be of numeric type. AVG(e.name) is parsable but is not semantically valid because the
type of name is a string (the property signature is: "private String name
").
Note: EclipseLink does not validate types, but leaves it to the database. This is because
some databases such as Oracle allow different types to different functions and perform implicit
type conversion. i.e. CONCAT('test', 2)
returns 'test2'
. Also the
FUNC function has an unknown type, so should be allowed with any function.
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.
EclipseLinkGrammarValidator
Modifier and Type | Class and Description |
---|---|
static class |
AbstractEclipseLinkSemanticValidator.EclipseLinkOwningClauseVisitor
This visitor retrieves the clause owning the visited
Expression . |
protected static class |
AbstractEclipseLinkSemanticValidator.SubquerySelectItemCalculator |
protected static class |
AbstractEclipseLinkSemanticValidator.TableExpressionVisitor |
protected static class |
AbstractEclipseLinkSemanticValidator.TopLevelFirstDeclarationVisitor |
AbstractSemanticValidator.CollectionValuedPathExpressionVisitor, AbstractSemanticValidator.ComparingEntityTypeLiteralVisitor, AbstractSemanticValidator.ComparisonExpressionVisitor, AbstractSemanticValidator.FirstDeclarationVisitor, AbstractSemanticValidator.InItemsVisitor, AbstractSemanticValidator.PathType, AbstractSemanticValidator.StateFieldPathExpressionVisitor, AbstractSemanticValidator.SubqueryFirstDeclarationVisitor
AbstractValidator.BypassChildCollectionExpressionVisitor, AbstractValidator.BypassParentSubExpressionVisitor, AbstractValidator.ChildrenCollectorVisitor, AbstractValidator.JPQLQueryBNFValidator, AbstractValidator.NestedArrayVisitor, AbstractValidator.OwningClauseVisitor, AbstractValidator.OwningStatementVisitor, AbstractValidator.SubqueryVisitor
collectionValuedPathExpressionVisitor, helper, registerIdentificationVariable, stateFieldPathExpressionVisitor, usedIdentificationVariables, virtualIdentificationVariableFinder
Modifier | Constructor and Description |
---|---|
protected |
AbstractEclipseLinkSemanticValidator(SemanticValidatorHelper helper,
EclipseLinkSemanticValidatorExtension extension)
Creates a new
AbstractEclipseLinkSemanticValidator . |
Modifier and Type | Method and Description |
---|---|
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 AbstractEclipseLinkSemanticValidator.SubquerySelectItemCalculator |
buildSubquerySelectItemCalculator() |
protected AbstractEclipseLinkSemanticValidator.TableExpressionVisitor |
buildTableExpressionVisitor() |
protected AbstractEclipseLinkSemanticValidator.TopLevelFirstDeclarationVisitor |
buildTopLevelFirstDeclarationVisitor() |
protected JPQLQueryDeclaration |
getDeclaration(java.lang.String variableName) |
protected EclipseLinkSemanticValidatorExtension |
getExtension()
Returns the extension that gives access to non-JPA metadata artifacts, such as database tables
and columns.
|
protected AbstractEclipseLinkSemanticValidator.SubquerySelectItemCalculator |
getSubquerySelectItemCalculator() |
protected AbstractEclipseLinkSemanticValidator.TableExpressionVisitor |
getTableExpressionVisitor() |
protected boolean |
isTableExpression(Expression expression) |
protected AbstractSemanticValidator.PathType |
selectClausePathExpressionPathType()
Returns the type of path expression that is allowed in the
SELECT clause. |
protected int |
subquerySelectItemCount(Expression subquery)
Retrieves the number of select items the given subquery has.
|
protected void |
validateFunctionExpression(FunctionExpression expression)
Validates the given
FunctionExpression . |
protected void |
validateInExpression(InExpression expression)
Validates the given
InExpression . |
protected void |
validateRangeVariableDeclarationRootObject(RangeVariableDeclaration expression)
Validates the "root" object of the given
RangeVariableDeclaration . |
protected java.lang.Boolean |
validateThirdPartyStateFieldPathExpression(StateFieldPathExpression expression)
Validates the given
StateFieldPathExpression , which means the path does not represent
a mapping, or an enum constant. |
protected AbstractSemanticValidator.PathType |
validPathExpressionTypeForCountFunction()
Returns the type of path expression that is valid for a count function; which is the left
expression in a
COUNT expression. |
protected AbstractSemanticValidator.PathType |
validPathExpressionTypeForInExpression()
Returns the type of path expression that is valid for the expression being tested by an
IN expression; which is the left expression. |
protected AbstractSemanticValidator.PathType |
validPathExpressionTypeForInItem()
Returns the type of path expression that is valid for an
IN items; which is the
left expression in a IN expression. |
protected AbstractSemanticValidator.PathType |
validPathExpressionTypeForStringExpression()
Returns the type of path expression that is valid for a string expression; which is the left
expression in a
LIKE expression. |
void |
visit(AsOfClause expression)
Visits the
AsOfClause expression. |
void |
visit(CastExpression expression)
Visits the
CastExpression expression. |
void |
visit(ConnectByClause expression)
Visits the
ConnectByClause expression. |
void |
visit(DatabaseType expression)
Visits the
DatabaseType expression. |
void |
visit(ExtractExpression expression)
Visits the
ExtractExpression expression. |
void |
visit(HierarchicalQueryClause expression)
Visits the
HierarchicalQueryClause expression. |
void |
visit(OrderSiblingsByClause expression)
Visits the
OrderSiblingsByClause expression. |
void |
visit(RegexpExpression expression)
Visits the
RegexpExpression expression. |
void |
visit(StartWithClause expression)
Visits the
StartWithClause 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. |
buildComparingEntityTypeLiteralVisitor, buildInItemsVisitor, buildSubqueryFirstDeclarationVisitor, dispose, findVirtualIdentificationVariable, getCollectionValuedPathExpression, getCollectionValuedPathExpressionVisitor, getComparingEntityTypeLiteralVisitor, getComparisonExpressionVisitor, getGrammar, getInItemsVisitor, getStateFieldPathExpression, getStateFieldPathExpressionVisitor, getVirtualIdentificationVariableFinder, initialize, isComparingEntityTypeLiteral, isIdentificationVariableDeclaredAfter, isIdentificationVariableValidInComparison, isOrderComparison, isValid, subqueryFirstDeclarationVisitor, topLevelFirstDeclarationVisitor, updateStatus, validateAbsExpression, validateAbstractFromClause, validateAbstractSchemaName, validateAdditionExpression, validateAllOrAnyExpression, validateAndExpression, validateArithmeticExpression, validateArithmeticExpression, validateAvgFunction, validateBetweenExpression, validateCaseExpression, validateCoalesceExpression, validateCollectionMemberDeclaration, validateCollectionMemberExpression, validateCollectionValuedPathExpression, validateComparisonExpression, validateConcatExpression, validateConstructorExpression, validateCountFunction, validateDateTime, validateDeleteClause, validateDeleteStatement, validateDivisionExpression, validateEntityTypeLiteral, validateEntryExpression, validateExistsExpression, validateFirstDeclaration, validateFromClause, validateFunctionPathExpression, validateFunctionPathExpression, validateGroupByClause, validateHavingClause, validateIdentificationVariable, validateIdentificationVariable, validateIdentificationVariableDeclaration, validateIdentificationVariables, validateIndexExpression, validateJoin, validateJoinsIdentificationVariable, validateKeyExpression, validateLengthExpression, validateLikeExpression, validateLocateExpression, validateLowerExpression, validateMaxFunction, validateMinFunction, validateModExpression, validateMultiplicationExpression, validateNotExpression, validateNullComparisonExpression, validateNullIfExpression, validateObjectExpression, validateOnClause, validateOrderByClause, validateOrderByItem, validateOrExpression, validateRangeVariableDeclaration, validateResultVariable, validateSelectClause, validateSelectStatement, validateSimpleFromClause, validateSimpleSelectClause, validateSimpleSelectStatement, validateSizeExpression, validateSqrtExpression, validateStateFieldPathExpression, validateSubstringExpression, validateSubtractionExpression, validateSumFunction, validateTreatExpression, validateTrimExpression, validateTypeExpression, validateUpdateClause, validateUpdateItem, validateUpdateStatement, validateUpperExpression, validateValueExpression, validateWhenClause, validateWhereClause, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit
addProblem, addProblem, addProblem, addProblem, buildChildrenCollector, buildNestedArrayVisitor, buildOwningStatementVisitor, buildProblem, buildSubqueryVisitor, getBypassChildCollectionExpressionVisitor, getBypassParentSubExpressionVisitor, getChildren, getChildrenCollectorVisitor, getExpressionRegistry, getExpressionValidator, getJPAVersion, getJPQLQueryBNFValidator, getJPQLQueryBNFValidator, getLiteralVisitor, getNestedArrayVisitor, getOwningClauseVisitor, getOwningStatementVisitor, getProvider, getProviderVersion, getQueryBNF, getSubqueryVisitor, isNestedArray, isSubquery, isValid, isValid, isValid, isValidWithChildCollectionBypass, isWithinSubquery, isWithinTopLevelQuery, length, literal, nestedArraySize, position, problemsSize, setProblems, visit
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit
protected AbstractEclipseLinkSemanticValidator(SemanticValidatorHelper helper, EclipseLinkSemanticValidatorExtension extension)
AbstractEclipseLinkSemanticValidator
.helper
- The given helper allows this validator to access the JPA artifacts without using
Hermes SPIextension
- The following extension can be used to give access to non-JPA metadata
artifacts, such as database tables and columnsjava.lang.NullPointerException
- The given SemanticValidatorHelper
cannot be null
protected LiteralVisitor buildLiteralVisitor()
buildLiteralVisitor
in class AbstractValidator
LiteralVisitor
protected AbstractValidator.OwningClauseVisitor buildOwningClauseVisitor()
Expression
and stops at
the first Expression
that is a clause.buildOwningClauseVisitor
in class AbstractValidator
AbstractValidator.OwningClauseVisitor
protected AbstractEclipseLinkSemanticValidator.SubquerySelectItemCalculator buildSubquerySelectItemCalculator()
protected AbstractEclipseLinkSemanticValidator.TableExpressionVisitor buildTableExpressionVisitor()
protected AbstractEclipseLinkSemanticValidator.TopLevelFirstDeclarationVisitor buildTopLevelFirstDeclarationVisitor()
buildTopLevelFirstDeclarationVisitor
in class AbstractSemanticValidator
protected JPQLQueryDeclaration getDeclaration(java.lang.String variableName)
protected EclipseLinkSemanticValidatorExtension getExtension()
EclipseLinkSemanticValidatorExtension.NULL_EXTENSION
if no extension was providedprotected AbstractEclipseLinkSemanticValidator.SubquerySelectItemCalculator getSubquerySelectItemCalculator()
protected AbstractEclipseLinkSemanticValidator.TableExpressionVisitor getTableExpressionVisitor()
protected boolean isTableExpression(Expression expression)
protected AbstractSemanticValidator.PathType selectClausePathExpressionPathType()
SELECT
clause.selectClausePathExpressionPathType
in class AbstractSemanticValidator
protected int subquerySelectItemCount(Expression subquery)
subquery
- The Expression
to visit, which should represents a subqueryprotected void validateFunctionExpression(FunctionExpression expression)
FunctionExpression
.validateFunctionExpression
in class AbstractSemanticValidator
expression
- The FunctionExpression
to validateprotected void validateInExpression(InExpression expression)
InExpression
. The test to perform is:
validateInExpression
in class AbstractSemanticValidator
expression
- The InExpression
to validateprotected void validateRangeVariableDeclarationRootObject(RangeVariableDeclaration expression)
RangeVariableDeclaration
.validateRangeVariableDeclarationRootObject
in class AbstractSemanticValidator
expression
- The RangeVariableDeclaration
that needs its "root" object
to be validatedprotected AbstractSemanticValidator.PathType validPathExpressionTypeForCountFunction()
COUNT
expression.validPathExpressionTypeForCountFunction
in class AbstractSemanticValidator
protected AbstractSemanticValidator.PathType validPathExpressionTypeForInExpression()
IN
expression; which is the left expression.validPathExpressionTypeForInExpression
in class AbstractSemanticValidator
protected AbstractSemanticValidator.PathType validPathExpressionTypeForInItem()
IN
items; which is the
left expression in a IN
expression.validPathExpressionTypeForInItem
in class AbstractSemanticValidator
protected java.lang.Boolean validateThirdPartyStateFieldPathExpression(StateFieldPathExpression expression)
StateFieldPathExpression
, which means the path does not represent
a mapping, or an enum constant.validateThirdPartyStateFieldPathExpression
in class AbstractSemanticValidator
expression
- The StateFieldPathExpression
the validateBoolean.TRUE
or Boolean.FALSE
if the given StateFieldPathExpression
was validated by this method; null
if it could not be
validated (as being valid or invalid)protected AbstractSemanticValidator.PathType validPathExpressionTypeForStringExpression()
LIKE
expression.validPathExpressionTypeForStringExpression
in class AbstractSemanticValidator
public void visit(AsOfClause expression)
AsOfClause
expression.visit
in interface EclipseLinkExpressionVisitor
expression
- The Expression
to visitpublic void visit(CastExpression expression)
CastExpression
expression.visit
in interface EclipseLinkExpressionVisitor
expression
- The Expression
to visitpublic void visit(ConnectByClause expression)
ConnectByClause
expression.visit
in interface EclipseLinkExpressionVisitor
expression
- The ConnectByClause
to visitpublic void visit(DatabaseType expression)
DatabaseType
expression.visit
in interface EclipseLinkExpressionVisitor
expression
- The DatabaseType
to visitpublic void visit(ExtractExpression expression)
ExtractExpression
expression.visit
in interface EclipseLinkExpressionVisitor
expression
- The Expression
to visitpublic void visit(HierarchicalQueryClause expression)
HierarchicalQueryClause
expression.visit
in interface EclipseLinkExpressionVisitor
expression
- The HierarchicalQueryClause
to visitpublic void visit(OrderSiblingsByClause expression)
OrderSiblingsByClause
expression.visit
in interface EclipseLinkExpressionVisitor
expression
- The Expression
to visitpublic void visit(RegexpExpression expression)
RegexpExpression
expression.visit
in interface EclipseLinkExpressionVisitor
expression
- The Expression
to visitpublic void visit(StartWithClause expression)
StartWithClause
expression.visit
in interface EclipseLinkExpressionVisitor
expression
- The StartWithClause
to visitpublic void visit(TableExpression expression)
TableExpression
expression.visit
in interface EclipseLinkExpressionVisitor
expression
- The Expression
to visitpublic void visit(TableVariableDeclaration expression)
TableVariableDeclaration
expression.visit
in interface EclipseLinkExpressionVisitor
expression
- The Expression
to visitpublic void visit(UnionClause expression)
UnionClause
expression.visit
in interface EclipseLinkExpressionVisitor
expression
- The Expression
to visit