Class DefaultSemanticValidator
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.tools.DefaultSemanticValidator
- All Implemented Interfaces:
ExpressionVisitor
This validator is responsible to gather the problems found in a JPQL query by validating the
content to make sure it is semantically valid. 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
").
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.3
- Version:
- 2.5
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected class
This visitor validates expression that is a boolean literal to make sure the type is a Boolean.protected static class
protected class
This visitor validates expression that is a numeric literal to make sure the type is an instance of Number.protected static class
protected class
This visitor validates that theExpression
is a string primary and to make sure the type is String.protected class
The basic validator for validating the type of anExpression
.protected static class
Nested classes/interfaces inherited from class org.eclipse.persistence.jpa.jpql.AbstractSemanticValidator
AbstractSemanticValidator.CollectionValuedPathExpressionVisitor, AbstractSemanticValidator.ComparingEntityTypeLiteralVisitor, AbstractSemanticValidator.ComparisonExpressionVisitor, AbstractSemanticValidator.FirstDeclarationVisitor, AbstractSemanticValidator.InItemsVisitor, AbstractSemanticValidator.PathType, AbstractSemanticValidator.StateFieldPathExpressionVisitor, AbstractSemanticValidator.SubqueryFirstDeclarationVisitor, AbstractSemanticValidator.TopLevelFirstDeclarationVisitor
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
-
Field Summary
Modifier and TypeFieldDescriptionThis validator determines whether theExpression
visited representsExpression.NULL
.This finder is responsible to retrieve the abstract schema name from the UPDATE range declaration expression.protected Map
<Class<? extends DefaultSemanticValidator.TypeValidator>, DefaultSemanticValidator.TypeValidator> TheTypeVlidators
mapped to their Java class.Fields inherited from class org.eclipse.persistence.jpa.jpql.AbstractSemanticValidator
collectionValuedPathExpressionVisitor, helper, registerIdentificationVariable, stateFieldPathExpressionVisitor, usedIdentificationVariables, virtualIdentificationVariableFinder
-
Constructor Summary
ConstructorDescriptionCreates a newDefaultSemanticValidator
.DefaultSemanticValidator
(JPQLQueryContext queryContext) Creates a newDefaultSemanticValidator
. -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
areTypesEquivalent
(Object[] typeDeclarations1, Object[] typeDeclarations2) protected 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.protected AbstractSchemaName
findAbstractSchemaName
(UpdateItem expression) protected Object
getType
(Expression expression) protected ITypeHelper
protected DefaultSemanticValidator.TypeValidator
getValidator
(Class<? extends DefaultSemanticValidator.TypeValidator> validatorClass) protected void
Initializes this validator.protected boolean
isBooleanType
(Expression expression) Determines whether the givenExpression
is of the correct type based on these rules: TheExpression
returns a boolean value;protected boolean
isComparisonEquivalentType
(Expression expression1, Expression expression2) protected boolean
isEquivalentBetweenType
(Expression expression1, Expression expression2) protected boolean
isIntegralType
(Expression expression) Determines whether the givenExpression
is of the correct type based on these rules: TheExpression
's type is an integral type (long or integer).protected boolean
isNullValue
(Expression expression) protected boolean
isNumericType
(Expression expression) Determines whether the givenExpression
is of the correct type based on these rules: TheExpression
returns a numeric value;protected boolean
isStringType
(Expression expression) Determines whether the givenExpression
is of the correct type based on these rules: TheExpression
's type is a string type.protected boolean
isValid
(Expression expression, Class<? extends DefaultSemanticValidator.TypeValidator> validatorClass) Determines whether the givenExpression
is of the correct type by using theDefaultSemanticValidator.TypeValidator
.protected boolean
isValidWithFindQueryBNF
(AbstractExpression expression, String queryBNF) protected AbstractSemanticValidator.PathType
Returns the type of path expression that is allowed in theSELECT
clause.protected boolean
validateAbsExpression
(AbsExpression expression) Validates the encapsulated expression of the givenABS
expression.protected int
validateArithmeticExpression
(ArithmeticExpression expression, String leftExpressionWrongTypeMessageKey, String rightExpressionWrongTypeMessageKey) Validates the type of the left and right expressions defined by the givenArithmeticExpression
.protected boolean
validateAvgFunction
(AvgFunction expression) Validates the encapsulated expression of the givenAVG
expression.protected int
validateBetweenExpression
(BetweenExpression expression) Validates the givenBetweenExpression
.protected boolean
validateBooleanType
(Expression expression, String messageKey) Determines whether the givenExpression
is of the correct type based on these rules: TheExpression
returns a boolean value; TheExpression
's type is a boolean type.protected int
Validates the givenCollectionMemberExpression
.protected boolean
validateComparisonExpression
(ComparisonExpression expression) Validates the left and right expressions of the givenComparisonExpression
.protected boolean
validateConcatExpression
(ConcatExpression expression) Validates the encapsulated expression of the givenCONCAT
expression.protected void
validateConstructorExpression
(ConstructorExpression expression) Validates the givenConstructorExpression
.protected void
validateCountFunction
(CountFunction expression) Validates the givenCountFunction
.protected void
validateEntryExpression
(EntryExpression expression) Validates the givenEntryExpression
.protected boolean
validateIdentificationVariable
(IdentificationVariable expression, String variable) Validates the given identification variable.protected boolean
validateIntegralType
(Expression expression, String queryBNF, String messageKey) Determines whether the givenExpression
is of the correct type based on these rules: TheExpression
returns a integral value; TheExpression
's type is an integral type (long or integer).protected void
validateKeyExpression
(KeyExpression expression) Validates the givenKeyExpression
.protected boolean
validateLengthExpression
(LengthExpression expression) Validates the encapsulated expression of the givenLENGTH
expression.protected int
validateLocateExpression
(LocateExpression expression) Validates the encapsulated expression of the givenLOCATE
expression.protected boolean
validateLowerExpression
(LowerExpression expression) Validates the encapsulated expression of the givenLOWER
expression.protected void
protected int
validateModExpression
(ModExpression expression) Validates the encapsulated expression of the givenMOD
expression.protected void
validateNotExpression
(NotExpression expression) Validates the givenNotExpression
.protected void
Validates the givenNullComparisonExpression
.protected boolean
validateNumericType
(Expression expression, String messageKey) Determines whether the givenExpression
is of the correct type based on these rules: TheExpression
returns a numeric value; TheExpression
's type is an numeric type.protected boolean
validateSqrtExpression
(SqrtExpression expression) Validates the encapsulated expression of the givenSQRT
expression.protected boolean
validateStringType
(Expression expression, String messageKey) Determines whether the givenExpression
is of the correct type based on these rules: TheExpression
returns a String value; TheExpression
's type is a String type.protected int
validateSubstringExpression
(SubstringExpression expression) Validates the encapsulated expression of the givenSUBSTRING
expression.protected boolean
validateSumFunction
(SumFunction expression) Validates the encapsulated expression of the givenMOD
expression.protected boolean
validateUpdateItem
(UpdateItem expression) Validates the givenUpdateItem
by validating the traversability of the path expression.protected void
validateUpdateItemTypes
(UpdateItem expression, Object type) protected boolean
validateUpperExpression
(UpperExpression expression) Validates the encapsulated expression of the givenUPPER
expression.protected void
validateValueExpression
(ValueExpression expression) Validates the givenValueExpression
.Methods inherited from class org.eclipse.persistence.jpa.jpql.AbstractSemanticValidator
buildComparingEntityTypeLiteralVisitor, buildInItemsVisitor, buildSubqueryFirstDeclarationVisitor, buildTopLevelFirstDeclarationVisitor, dispose, findVirtualIdentificationVariable, getCollectionValuedPathExpression, getCollectionValuedPathExpressionVisitor, getComparingEntityTypeLiteralVisitor, getComparisonExpressionVisitor, getGrammar, getInItemsVisitor, getStateFieldPathExpression, getStateFieldPathExpressionVisitor, getVirtualIdentificationVariableFinder, isComparingEntityTypeLiteral, isIdentificationVariableDeclaredAfter, isIdentificationVariableValidInComparison, isOrderComparison, isValid, subqueryFirstDeclarationVisitor, topLevelFirstDeclarationVisitor, updateStatus, validateAbstractFromClause, validateAbstractSchemaName, validateAdditionExpression, validateAllOrAnyExpression, validateAndExpression, validateArithmeticExpression, validateCaseExpression, validateCoalesceExpression, validateCollectionMemberDeclaration, validateCollectionValuedPathExpression, validateDateTime, validateDeleteClause, validateDeleteStatement, validateDivisionExpression, validateEntityTypeLiteral, validateExistsExpression, validateFirstDeclaration, validateFromClause, validateFunctionExpression, validateFunctionPathExpression, validateFunctionPathExpression, validateGroupByClause, validateHavingClause, validateIdentificationVariable, validateIdentificationVariableDeclaration, validateIdentificationVariables, validateIndexExpression, validateInExpression, validateJoin, validateJoinCollectionValuedPathExpression, validateJoinsIdentificationVariable, validateLikeExpression, validateMaxFunction, validateMinFunction, validateMultiplicationExpression, validateNullIfExpression, validateObjectExpression, validateOnClause, validateOrderByClause, validateOrderByItem, validateOrExpression, validateRangeVariableDeclaration, validateRangeVariableDeclarationRootObject, validateResultVariable, validateSelectClause, validateSelectStatement, validateSimpleFromClause, validateSimpleSelectClause, validateSimpleSelectStatement, validateSizeExpression, validateStateFieldPathExpression, validateSubtractionExpression, validateThirdPartyStateFieldPathExpression, validateTreatExpression, validateTrimExpression, validateTypeExpression, validateUpdateClause, validateUpdateStatement, validateWhenClause, validateWhereClause, validPathExpressionTypeForCountFunction, validPathExpressionTypeForInExpression, validPathExpressionTypeForInItem, validPathExpressionTypeForStringExpression, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, 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, getOwningClauseVisitor, getOwningStatementVisitor, getProvider, getProviderVersion, getQueryBNF, getSubqueryVisitor, isNestedArray, isSubquery, isValid, isValid, isValid, isValidWithChildCollectionBypass, isWithinSubquery, isWithinTopLevelQuery, length, literal, nestedArraySize, position, problemsSize, setProblems, visit
-
Field Details
-
nullValueVisitor
This validator determines whether theExpression
visited representsExpression.NULL
. -
updateClauseAbstractSchemaNameFinder
protected DefaultSemanticValidator.UpdateClauseAbstractSchemaNameFinder updateClauseAbstractSchemaNameFinderThis finder is responsible to retrieve the abstract schema name from the UPDATE range declaration expression. -
validators
protected Map<Class<? extends DefaultSemanticValidator.TypeValidator>,DefaultSemanticValidator.TypeValidator> validatorsTheTypeVlidators
mapped to their Java class. Those validators validate anyExpression
by making sure its type matches the desired type.
-
-
Constructor Details
-
DefaultSemanticValidator
Creates a newDefaultSemanticValidator
.- Parameters:
queryContext
- The context used to query information about the JPQL query- Throws:
NullPointerException
- The givenJPQLQueryContext
cannot benull
-
DefaultSemanticValidator
Creates a newDefaultSemanticValidator
.- Parameters:
helper
- The given helper allows the validator to access the JPA artifacts without using Hermes SPI directly- Throws:
NullPointerException
- The givenSemanticValidatorHelper
cannot benull
- Since:
- 2.4
-
-
Method Details
-
areTypesEquivalent
-
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
-
buildResultVariableInOrderByVisitor
protected DefaultSemanticValidator.ResultVariableInOrderByVisitor buildResultVariableInOrderByVisitor() -
findAbstractSchemaName
-
getNullValueVisitor
-
getType
-
getTypeHelper
-
getUpdateClauseAbstractSchemaNameFinder
protected DefaultSemanticValidator.UpdateClauseAbstractSchemaNameFinder getUpdateClauseAbstractSchemaNameFinder() -
getValidator
protected DefaultSemanticValidator.TypeValidator getValidator(Class<? extends DefaultSemanticValidator.TypeValidator> validatorClass) -
initialize
protected void initialize()Description copied from class:AbstractValidator
Initializes this validator.- Overrides:
initialize
in classAbstractSemanticValidator
-
isBooleanType
Determines whether the givenExpression
is of the correct type based on these rules:- The
Expression
returns a boolean value;
- Parameters:
expression
- TheExpression
to validate- Returns:
true
if the givenExpression
passes the checks;false
otherwise
- The
-
isComparisonEquivalentType
-
isEquivalentBetweenType
-
isIntegralType
Determines whether the givenExpression
is of the correct type based on these rules:- The
Expression
's type is an integral type (long or integer).
- Parameters:
expression
- TheExpression
to validate- Returns:
true
if the givenExpression
passes the checks;false
otherwise
- The
-
isNullValue
-
isNumericType
Determines whether the givenExpression
is of the correct type based on these rules:- The
Expression
returns a numeric value;
- Parameters:
expression
- TheExpression
to validate- Returns:
true
if the givenExpression
passes the checks;false
otherwise
- The
-
isStringType
Determines whether the givenExpression
is of the correct type based on these rules:- The
Expression
's type is a string type.
- Parameters:
expression
- TheExpression
to validate- Returns:
true
if the givenExpression
passes the checks;false
otherwise
- The
-
isValid
protected boolean isValid(Expression expression, Class<? extends DefaultSemanticValidator.TypeValidator> validatorClass) Determines whether the givenExpression
is of the correct type by using theDefaultSemanticValidator.TypeValidator
.- Parameters:
expression
- TheExpression
to validatevalidatorClass
- The Java class of theDefaultSemanticValidator.TypeValidator
that will determine if the givenExpression
has the right type- Returns:
true
if the givenExpression
passes the checks;false
otherwise
-
isValidWithFindQueryBNF
-
selectClausePathExpressionPathType
Description copied from class:AbstractSemanticValidator
Returns the type of path expression that is allowed in theSELECT
clause.- Specified by:
selectClausePathExpressionPathType
in classAbstractSemanticValidator
- Returns:
- The type of path expressions allowed. The spec defines it as basic or object mapping only, i.e. collection-valued path expression is not allowed
-
validateAbsExpression
Description copied from class:AbstractSemanticValidator
Validates the encapsulated expression of the givenABS
expression. The test to perform is:- If the encapsulated expression is a path expression, validation makes sure it is a basic mapping, an association field is not allowed.
- If the encapsulated expression is not a path expression, validation will be redirected to that expression but the returned status will not be changed.
- Overrides:
validateAbsExpression
in classAbstractSemanticValidator
- Parameters:
expression
- TheAbsExpression
to validate by validating its encapsulated expression- Returns:
false
if the encapsulated expression was validated and is invalid;true
otherwise
-
validateArithmeticExpression
protected int validateArithmeticExpression(ArithmeticExpression expression, String leftExpressionWrongTypeMessageKey, String rightExpressionWrongTypeMessageKey) Description copied from class:AbstractSemanticValidator
Validates the type of the left and right expressions defined by the givenArithmeticExpression
. The test to perform is:- If the encapsulated expression is a path expression, validation makes sure it is a basic mapping, an association field is not allowed.
- If the encapsulated expression is not a path expression, validation will be redirected to that expression but the returned status will not be changed.
- Overrides:
validateArithmeticExpression
in classAbstractSemanticValidator
- Parameters:
expression
- TheArithmeticExpression
to validateleftExpressionWrongTypeMessageKey
- The key used to describe the left expression does not have a valid typerightExpressionWrongTypeMessageKey
- The key used to describe the right expression does not have a valid type- Returns:
- A number indicating the validation result.
AbstractSemanticValidator.isValid(int, int)
can be used to determine the validation status of an expression based on its position
-
validateAvgFunction
Description copied from class:AbstractSemanticValidator
Validates the encapsulated expression of the givenAVG
expression. The test to perform is:- If the encapsulated expression is a path expression, validation makes sure it is a basic mapping, an association field is not allowed.
- If the encapsulated expression is not a path expression, validation will be redirected to that expression but the returned status will not be changed.
- Overrides:
validateAvgFunction
in classAbstractSemanticValidator
- Parameters:
expression
- TheAvgFunction
to validate by validating its encapsulated expression- Returns:
false
if the encapsulated expression was validated and is invalid;true
otherwise
-
validateBetweenExpression
Description copied from class:AbstractSemanticValidator
Validates the givenBetweenExpression
. The test to perform is:- If the "first" expression is a path expression, validation makes sure it is a basic mapping, an association field is not allowed.
- Overrides:
validateBetweenExpression
in classAbstractSemanticValidator
- Parameters:
expression
- TheBetweenExpression
to validate- Returns:
- A number indicating the validation result.
AbstractSemanticValidator.isValid(int, int)
can be used to determine the validation status of an expression based on its position
-
validateBooleanType
Determines whether the givenExpression
is of the correct type based on these rules:- The
Expression
returns a boolean value; - The
Expression
's type is a boolean type.
- Parameters:
expression
- TheExpression
to validatemessageKey
- The key used to retrieve the localized message describing the problem
- The
-
validateCollectionMemberExpression
Description copied from class:AbstractSemanticValidator
Validates the givenCollectionMemberExpression
. Only the collection-valued path expression is validated.- Overrides:
validateCollectionMemberExpression
in classAbstractSemanticValidator
- Parameters:
expression
- TheCollectionMemberExpression
to validate- Returns:
- A number indicating the validation result.
AbstractSemanticValidator.isValid(int, int)
can be used to determine the validation status of an expression based on its position
-
validateComparisonExpression
Description copied from class:AbstractSemanticValidator
Validates the left and right expressions of the givenComparisonExpression
. The tests to perform are:- If the comparison operator is either '=' or '<>'. The expressions can only be
- Two identification variables;
- Two path expressions resolving to an association field;
- One can be a path expression resolving to a basic field and the other one has to resolve to a basic value.
- If the comparison operator is either '<', '<=', '>=', '>'. The expressions cannot be
- Two identification variables;
- Two path expressions resolving to an association field;
- Overrides:
validateComparisonExpression
in classAbstractSemanticValidator
- Parameters:
expression
- TheConcatExpression
to validate by validating its left and right expressions- Returns:
- The status of the comparison between the left and right expression:
true
if the two expressions pass the rules defined by this method;false
otherwise
- If the comparison operator is either '=' or '<>'. The expressions can only be
-
validateConcatExpression
Description copied from class:AbstractSemanticValidator
Validates the encapsulated expression of the givenCONCAT
expression. The tests to perform are:- If the encapsulated expression is a path expression, validation makes sure it is a basic mapping, an association field is not allowed.
- If the encapsulated expression is not a path expression, validation will be redirected to that expression but the returned status will not be changed.
- Overrides:
validateConcatExpression
in classAbstractSemanticValidator
- Parameters:
expression
- TheConcatExpression
to validate by validating its encapsulated expression- Returns:
false
if the first encapsulated expression was validated and is invalid;true
otherwise
-
validateConstructorExpression
Description copied from class:AbstractSemanticValidator
Validates the givenConstructorExpression
. The default behavior does not require to semantically validate it.- Overrides:
validateConstructorExpression
in classAbstractSemanticValidator
- Parameters:
expression
- TheConstructorExpression
to validate
-
validateCountFunction
Description copied from class:AbstractSemanticValidator
Validates the givenCountFunction
. The default behavior does not require to semantically validate it.- Overrides:
validateCountFunction
in classAbstractSemanticValidator
- Parameters:
expression
- TheCountFunction
to validate
-
validateEntryExpression
Description copied from class:AbstractSemanticValidator
Validates the givenEntryExpression
. The default behavior does not require to semantically validate it.- Overrides:
validateEntryExpression
in classAbstractSemanticValidator
- Parameters:
expression
- TheEntryExpression
to validate
-
validateIdentificationVariable
protected boolean validateIdentificationVariable(IdentificationVariable expression, String variable) Description copied from class:AbstractSemanticValidator
Validates the given identification variable. The default behavior is to not validate it.- Overrides:
validateIdentificationVariable
in classAbstractSemanticValidator
- Parameters:
expression
- TheIdentificationVariable
that is being visitedvariable
- The actual identification variable, which is never an empty string- Returns:
true
if the given identification variable is valid;false
otherwise
-
validateIntegralType
Determines whether the givenExpression
is of the correct type based on these rules:- The
Expression
returns a integral value; - The
Expression
's type is an integral type (long or integer).
- Parameters:
expression
- TheExpression
to validatequeryBNF
- The unique identifier of the query BNF used to validate the typemessageKey
- The key used to retrieve the localized message describing the problem- Returns:
false
if the given expression was validated and is invalid;true
otherwise
- The
-
validateKeyExpression
Description copied from class:AbstractSemanticValidator
Validates the givenKeyExpression
. The default behavior does not require to semantically validate it.- Overrides:
validateKeyExpression
in classAbstractSemanticValidator
- Parameters:
expression
- TheKeyExpression
to validate
-
validateLengthExpression
Description copied from class:AbstractSemanticValidator
Validates the encapsulated expression of the givenLENGTH
expression. The test to perform is:- If the encapsulated expression is a path expression, validation makes sure it is a basic mapping, an association field is not allowed.
- If the encapsulated expression is not a path expression, validation will be redirected to that expression but the returned status will not be changed.
- Overrides:
validateLengthExpression
in classAbstractSemanticValidator
- Parameters:
expression
- TheLengthExpression
to validate by validating its encapsulated expression- Returns:
false
if the encapsulated expression was validated and is invalid;true
otherwise
-
validateLocateExpression
Description copied from class:AbstractSemanticValidator
Validates the encapsulated expression of the givenLOCATE
expression. The test to perform is:- If the encapsulated expression is a path expression, validation makes sure it is a basic mapping, an association field is not allowed.
- If the encapsulated expression is not a path expression, validation will be redirected to that expression but the returned status will not be changed.
- Overrides:
validateLocateExpression
in classAbstractSemanticValidator
- Parameters:
expression
- TheLocateExpression
to validate by validating its encapsulated expression- Returns:
- A number indicating the validation result.
AbstractSemanticValidator.isValid(int, int)
can be used to determine the validation status of an expression based on its position
-
validateLowerExpression
Description copied from class:AbstractSemanticValidator
Validates the encapsulated expression of the givenLOWER
expression. The test to perform is:- If the encapsulated expression is a path expression, validation makes sure it is a basic mapping, an association field is not allowed.
- If the encapsulated expression is not a path expression, validation will be redirected to that expression but the returned status will not be changed.
- Overrides:
validateLowerExpression
in classAbstractSemanticValidator
- Parameters:
expression
- TheLowerExpression
to validate by validating its encapsulated expression- Returns:
false
if the encapsulated expression was validated and is invalid;true
otherwise
-
validateMapIdentificationVariable
protected void validateMapIdentificationVariable(EncapsulatedIdentificationVariableExpression expression) -
validateModExpression
Description copied from class:AbstractSemanticValidator
Validates the encapsulated expression of the givenMOD
expression. The test to perform is:- If the encapsulated expression is a path expression, validation makes sure it is a basic mapping, an association field is not allowed.
- If the encapsulated expression is not a path expression, validation will be redirected to that expression but the returned status will not be changed.
- Overrides:
validateModExpression
in classAbstractSemanticValidator
- Parameters:
expression
- TheModExpression
to validate by validating its encapsulated expression- Returns:
- A number indicating the validation result.
AbstractSemanticValidator.isValid(int, int)
can be used to determine the validation status of an expression based on its position
-
validateNotExpression
Description copied from class:AbstractSemanticValidator
Validates the givenNotExpression
. The default behavior does not require to semantically validate it.- Overrides:
validateNotExpression
in classAbstractSemanticValidator
- Parameters:
expression
- TheNotExpression
to validate
-
validateNullComparisonExpression
Description copied from class:AbstractSemanticValidator
Validates the givenNullComparisonExpression
. The default behavior does not require to semantically validate it.- Overrides:
validateNullComparisonExpression
in classAbstractSemanticValidator
- Parameters:
expression
- TheNullComparisonExpression
to validate
-
validateNumericType
Determines whether the givenExpression
is of the correct type based on these rules:- The
Expression
returns a numeric value; - The
Expression
's type is an numeric type.
- Parameters:
expression
- TheExpression
to validatemessageKey
- The key used to retrieve the localized message describing the problem- Returns:
false
if the given expression was validated and is invalid;true
otherwise
- The
-
validateSqrtExpression
Description copied from class:AbstractSemanticValidator
Validates the encapsulated expression of the givenSQRT
expression. The test to perform is:- If the encapsulated expression is a path expression, validation makes sure it is a basic mapping, an association field is not allowed.
- If the encapsulated expression is not a path expression, validation will be redirected to that expression but the returned status will not be changed.
- Overrides:
validateSqrtExpression
in classAbstractSemanticValidator
- Parameters:
expression
- TheSqrtExpression
to validate by validating its encapsulated expression- Returns:
false
if the encapsulated expression was validated and is invalid;true
otherwise
-
validateStringType
Determines whether the givenExpression
is of the correct type based on these rules:- The
Expression
returns a String value; - The
Expression
's type is a String type.
- Parameters:
expression
- TheExpression
to validatemessageKey
- The key used to retrieve the localized message describing the problem- Returns:
false
if the given expression was validated and is invalid;true
otherwise
- The
-
validateSubstringExpression
Description copied from class:AbstractSemanticValidator
Validates the encapsulated expression of the givenSUBSTRING
expression. The test to perform is:- If the encapsulated expression is a path expression, validation makes sure it is a basic mapping, an association field is not allowed.
- If the encapsulated expression is not a path expression, validation will be redirected to that expression but the returned status will not be changed.
- Overrides:
validateSubstringExpression
in classAbstractSemanticValidator
- Parameters:
expression
- TheSubstringExpression
to validate by validating its encapsulated expression- Returns:
- A number indicating the validation result.
AbstractSemanticValidator.isValid(int, int)
can be used to determine the validation status of an expression based on its position
-
validateSumFunction
Description copied from class:AbstractSemanticValidator
Validates the encapsulated expression of the givenMOD
expression. The test to perform is:- If the encapsulated expression is a path expression, validation makes sure it is a basic mapping, an association field is not allowed.
- If the encapsulated expression is not a path expression, validation will be redirected to that expression but the returned status will not be changed.
- Overrides:
validateSumFunction
in classAbstractSemanticValidator
- Parameters:
expression
- TheModExpression
to validate by validating its encapsulated expression- Returns:
false
if the encapsulated expression was validated and is invalid;true
otherwise
-
validateUpdateItem
Description copied from class:AbstractSemanticValidator
Validates the givenUpdateItem
by validating the traversability of the path expression. The path expression is valid if it follows one of the following rules:- The identification variable is omitted if it's not defined in the FROM clause;
- The last path is a state field;
- Only embedded field can be traversed.
- Overrides:
validateUpdateItem
in classAbstractSemanticValidator
- Parameters:
expression
-UpdateItem
to validate its path expression- Returns:
true
if the path expression is valid;false
otherwise
-
validateUpdateItemTypes
-
validateUpperExpression
Description copied from class:AbstractSemanticValidator
Validates the encapsulated expression of the givenUPPER
expression. The test to perform is:- If the encapsulated expression is a path expression, validation makes sure it is a basic mapping, an association field is not allowed.
- If the encapsulated expression is not a path expression, validation will be redirected to that expression but the returned status will not be changed.
- Overrides:
validateUpperExpression
in classAbstractSemanticValidator
- Parameters:
expression
- TheUpperExpression
to validate by validating its encapsulated expression- Returns:
false
if the encapsulated expression was validated and is invalid;true
otherwise
-
validateValueExpression
Description copied from class:AbstractSemanticValidator
Validates the givenValueExpression
. The default behavior does not require to semantically validate it.- Overrides:
validateValueExpression
in classAbstractSemanticValidator
- Parameters:
expression
- TheValueExpression
to validate
-