|
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.Object org.eclipse.persistence.jpa.jpql.parser.AnonymousExpressionVisitor org.eclipse.persistence.jpa.jpql.AbstractValidator org.eclipse.persistence.jpa.jpql.AbstractSemanticValidator org.eclipse.persistence.jpa.jpql.EclipseLinkSemanticValidator
public class EclipseLinkSemanticValidator
This validator is responsible to gather the problems found in a JPQL query by validating the content to make sure it is semantically valid for EclipseLink. The grammar is not validated by this visitor.
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
Nested Class Summary | |
---|---|
protected class |
EclipseLinkSemanticValidator.TopLevelFirstDeclarationVisitor
|
Nested classes/interfaces inherited from class org.eclipse.persistence.jpa.jpql.AbstractSemanticValidator |
---|
AbstractSemanticValidator.ComparingEntityTypeLiteralVisitor, AbstractSemanticValidator.ComparisonExpressionVisitor, AbstractSemanticValidator.FirstDeclarationVisitor, AbstractSemanticValidator.PathType, AbstractSemanticValidator.SubqueryFirstDeclarationVisitor |
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 |
Field Summary |
---|
Fields inherited from class org.eclipse.persistence.jpa.jpql.AbstractSemanticValidator |
---|
collectionValuedPathExpressionVisitor, helper, registerIdentificationVariable, stateFieldPathExpressionVisitor, usedIdentificationVariables, virtualIdentificationVariableFinder |
Constructor Summary | |
---|---|
EclipseLinkSemanticValidator(JPQLQueryContext queryContext)
Creates a new EclipseLinkSemanticValidator . |
|
EclipseLinkSemanticValidator(SemanticValidatorHelper helper)
Creates a new EclipseLinkSemanticValidator . |
Method Summary | |
---|---|
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 EclipseLinkSemanticValidator.TopLevelFirstDeclarationVisitor |
buildTopLevelFirstDeclarationVisitor()
|
protected boolean |
isEclipseLink2_4OrLater()
|
protected AbstractSemanticValidator.PathType |
selectClausePathExpressionPathType()
Returns the type of path expression that is allowed in the SELECT clause. |
protected void |
validateRangeVariableDeclarationRootObject(RangeVariableDeclaration expression)
Validates the "root" object of the given RangeVariableDeclaration . |
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 |
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(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.parser.AnonymousExpressionVisitor |
---|
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 |
---|
public EclipseLinkSemanticValidator(JPQLQueryContext queryContext)
EclipseLinkSemanticValidator
.
queryContext
- The context used to query information about the JPQL query
java.lang.NullPointerException
- The given JPQLQueryContext
cannot be null
public EclipseLinkSemanticValidator(SemanticValidatorHelper helper)
EclipseLinkSemanticValidator
.
helper
- The given helper allows this validator to access the JPA artifacts without using
Hermes SPI
java.lang.NullPointerException
- The given SemanticValidatorHelper
cannot be null
Method Detail |
---|
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 EclipseLinkSemanticValidator.TopLevelFirstDeclarationVisitor buildTopLevelFirstDeclarationVisitor()
buildTopLevelFirstDeclarationVisitor
in class AbstractSemanticValidator
protected boolean isEclipseLink2_4OrLater()
protected AbstractSemanticValidator.PathType selectClausePathExpressionPathType()
SELECT
clause.
selectClausePathExpressionPathType
in class AbstractSemanticValidator
protected void validateRangeVariableDeclarationRootObject(RangeVariableDeclaration expression)
RangeVariableDeclaration
.
validateRangeVariableDeclarationRootObject
in class AbstractSemanticValidator
expression
- The RangeVariableDeclaration
that needs its "root" object
to be validatedprotected AbstractSemanticValidator.PathType validPathExpressionTypeForInExpression()
IN
expression; which is the left expression.
validPathExpressionTypeForInExpression
in class AbstractSemanticValidator
protected AbstractSemanticValidator.PathType validPathExpressionTypeForStringExpression()
LIKE
expression.
validPathExpressionTypeForStringExpression
in class AbstractSemanticValidator
public void visit(CastExpression expression)
CastExpression
expression.
visit
in interface EclipseLinkExpressionVisitor
expression
- The Expression
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(RegexpExpression expression)
visit
in interface EclipseLinkExpressionVisitor
public 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
|
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 |