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
Nested ClassesModifier and TypeClassDescriptionprotected classThis visitor validates expression that is a boolean literal to make sure the type is a Boolean.protected static classprotected classThis visitor validates expression that is a numeric literal to make sure the type is an instance of Number.protected static classprotected classThis visitor validates that theExpressionis a string primary and to make sure the type is String.protected classThe basic validator for validating the type of anExpression.protected static classNested 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.TopLevelFirstDeclarationVisitorNested 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
FieldsModifier and TypeFieldDescriptionThis validator determines whether theExpressionvisited 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> TheTypeVlidatorsmapped to their Java class.Fields inherited from class org.eclipse.persistence.jpa.jpql.AbstractSemanticValidator
collectionValuedPathExpressionVisitor, helper, registerIdentificationVariable, stateFieldPathExpressionVisitor, usedIdentificationVariables, virtualIdentificationVariableFinder -
Constructor Summary
ConstructorsConstructorDescriptionCreates a newDefaultSemanticValidator.DefaultSemanticValidator(JPQLQueryContext queryContext) Creates a newDefaultSemanticValidator. -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanareTypesEquivalent(Object[] typeDeclarations1, Object[] typeDeclarations2) protected LiteralVisitorCreates the visitor that can retrieve some information about various literal.protected AbstractValidator.OwningClauseVisitorCreates the visitor that traverses the parent hierarchy of anyExpressionand stops at the firstExpressionthat is a clause.protected AbstractSchemaNamefindAbstractSchemaName(UpdateItem expression) protected ObjectgetType(Expression expression) protected ITypeHelperprotected DefaultSemanticValidator.TypeValidatorgetValidator(Class<? extends DefaultSemanticValidator.TypeValidator> validatorClass) protected voidInitializes this validator.protected booleanisBooleanType(Expression expression) Determines whether the givenExpressionis of the correct type based on these rules: TheExpressionreturns a boolean value;protected booleanisComparisonEquivalentType(Expression expression1, Expression expression2) protected booleanisEquivalentBetweenType(Expression expression1, Expression expression2) protected booleanisIntegralType(Expression expression) Determines whether the givenExpressionis of the correct type based on these rules: TheExpression's type is an integral type (long or integer).protected booleanisNullValue(Expression expression) protected booleanisNumericType(Expression expression) Determines whether the givenExpressionis of the correct type based on these rules: TheExpressionreturns a numeric value;protected booleanisStringType(Expression expression) Determines whether the givenExpressionis of the correct type based on these rules: TheExpression's type is a string type.protected booleanisValid(Expression expression, Class<? extends DefaultSemanticValidator.TypeValidator> validatorClass) Determines whether the givenExpressionis of the correct type by using theDefaultSemanticValidator.TypeValidator.protected booleanisValidWithFindQueryBNF(AbstractExpression expression, String queryBNF) protected AbstractSemanticValidator.PathTypeReturns the type of path expression that is allowed in theSELECTclause.protected booleanvalidateAbsExpression(AbsExpression expression) Validates the encapsulated expression of the givenABSexpression.protected intvalidateArithmeticExpression(ArithmeticExpression expression, String leftExpressionWrongTypeMessageKey, String rightExpressionWrongTypeMessageKey) Validates the type of the left and right expressions defined by the givenArithmeticExpression.protected booleanvalidateAvgFunction(AvgFunction expression) Validates the encapsulated expression of the givenAVGexpression.protected intvalidateBetweenExpression(BetweenExpression expression) Validates the givenBetweenExpression.protected booleanvalidateBooleanType(Expression expression, String messageKey) Determines whether the givenExpressionis of the correct type based on these rules: TheExpressionreturns a boolean value; TheExpression's type is a boolean type.protected intValidates the givenCollectionMemberExpression.protected booleanvalidateComparisonExpression(ComparisonExpression expression) Validates the left and right expressions of the givenComparisonExpression.protected booleanvalidateConcatExpression(ConcatExpression expression) Validates the encapsulated expression of the givenCONCATexpression.protected voidvalidateConstructorExpression(ConstructorExpression expression) Validates the givenConstructorExpression.protected voidvalidateCountFunction(CountFunction expression) Validates the givenCountFunction.protected voidvalidateEntryExpression(EntryExpression expression) Validates the givenEntryExpression.protected booleanvalidateIdentificationVariable(IdentificationVariable expression, String variable) Validates the given identification variable.protected booleanvalidateIntegralType(Expression expression, String queryBNF, String messageKey) Determines whether the givenExpressionis of the correct type based on these rules: TheExpressionreturns a integral value; TheExpression's type is an integral type (long or integer).protected voidvalidateKeyExpression(KeyExpression expression) Validates the givenKeyExpression.protected booleanvalidateLengthExpression(LengthExpression expression) Validates the encapsulated expression of the givenLENGTHexpression.protected intvalidateLocateExpression(LocateExpression expression) Validates the encapsulated expression of the givenLOCATEexpression.protected booleanvalidateLowerExpression(LowerExpression expression) Validates the encapsulated expression of the givenLOWERexpression.protected voidprotected intvalidateModExpression(ModExpression expression) Validates the encapsulated expression of the givenMODexpression.protected voidvalidateNotExpression(NotExpression expression) Validates the givenNotExpression.protected voidValidates the givenNullComparisonExpression.protected booleanvalidateNumericType(Expression expression, String messageKey) Determines whether the givenExpressionis of the correct type based on these rules: TheExpressionreturns a numeric value; TheExpression's type is an numeric type.protected booleanvalidateSqrtExpression(SqrtExpression expression) Validates the encapsulated expression of the givenSQRTexpression.protected booleanvalidateStringType(Expression expression, String messageKey) Determines whether the givenExpressionis of the correct type based on these rules: TheExpressionreturns a String value; TheExpression's type is a String type.protected intvalidateSubstringExpression(SubstringExpression expression) Validates the encapsulated expression of the givenSUBSTRINGexpression.protected booleanvalidateSumFunction(SumFunction expression) Validates the encapsulated expression of the givenMODexpression.protected booleanvalidateUpdateItem(UpdateItem expression) Validates the givenUpdateItemby validating the traversability of the path expression.protected voidvalidateUpdateItemTypes(UpdateItem expression, Object type) protected booleanvalidateUpperExpression(UpperExpression expression) Validates the encapsulated expression of the givenUPPERexpression.protected voidvalidateValueExpression(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, visitMethods 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 theExpressionvisited 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> validatorsTheTypeVlidatorsmapped to their Java class. Those validators validate anyExpressionby 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 givenJPQLQueryContextcannot 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 givenSemanticValidatorHelpercannot benull- Since:
- 2.4
-
-
Method Details
-
areTypesEquivalent
-
buildLiteralVisitor
Description copied from class:AbstractValidatorCreates the visitor that can retrieve some information about various literal.- Specified by:
buildLiteralVisitorin classAbstractValidator- Returns:
- A new
LiteralVisitor
-
buildOwningClauseVisitor
Description copied from class:AbstractValidatorCreates the visitor that traverses the parent hierarchy of anyExpressionand stops at the firstExpressionthat is a clause.- Specified by:
buildOwningClauseVisitorin 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:AbstractValidatorInitializes this validator.- Overrides:
initializein classAbstractSemanticValidator
-
isBooleanType
Determines whether the givenExpressionis of the correct type based on these rules:- The
Expressionreturns a boolean value;
- Parameters:
expression- TheExpressionto validate- Returns:
trueif the givenExpressionpasses the checks;falseotherwise
- The
-
isComparisonEquivalentType
-
isEquivalentBetweenType
-
isIntegralType
Determines whether the givenExpressionis of the correct type based on these rules:- The
Expression's type is an integral type (long or integer).
- Parameters:
expression- TheExpressionto validate- Returns:
trueif the givenExpressionpasses the checks;falseotherwise
- The
-
isNullValue
-
isNumericType
Determines whether the givenExpressionis of the correct type based on these rules:- The
Expressionreturns a numeric value;
- Parameters:
expression- TheExpressionto validate- Returns:
trueif the givenExpressionpasses the checks;falseotherwise
- The
-
isStringType
Determines whether the givenExpressionis of the correct type based on these rules:- The
Expression's type is a string type.
- Parameters:
expression- TheExpressionto validate- Returns:
trueif the givenExpressionpasses the checks;falseotherwise
- The
-
isValid
protected boolean isValid(Expression expression, Class<? extends DefaultSemanticValidator.TypeValidator> validatorClass) Determines whether the givenExpressionis of the correct type by using theDefaultSemanticValidator.TypeValidator.- Parameters:
expression- TheExpressionto validatevalidatorClass- The Java class of theDefaultSemanticValidator.TypeValidatorthat will determine if the givenExpressionhas the right type- Returns:
trueif the givenExpressionpasses the checks;falseotherwise
-
isValidWithFindQueryBNF
-
selectClausePathExpressionPathType
Description copied from class:AbstractSemanticValidatorReturns the type of path expression that is allowed in theSELECTclause.- Specified by:
selectClausePathExpressionPathTypein 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:AbstractSemanticValidatorValidates the encapsulated expression of the givenABSexpression. 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:
validateAbsExpressionin classAbstractSemanticValidator- Parameters:
expression- TheAbsExpressionto validate by validating its encapsulated expression- Returns:
falseif the encapsulated expression was validated and is invalid;trueotherwise
-
validateArithmeticExpression
protected int validateArithmeticExpression(ArithmeticExpression expression, String leftExpressionWrongTypeMessageKey, String rightExpressionWrongTypeMessageKey) Description copied from class:AbstractSemanticValidatorValidates 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:
validateArithmeticExpressionin classAbstractSemanticValidator- Parameters:
expression- TheArithmeticExpressionto 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:AbstractSemanticValidatorValidates the encapsulated expression of the givenAVGexpression. 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:
validateAvgFunctionin classAbstractSemanticValidator- Parameters:
expression- TheAvgFunctionto validate by validating its encapsulated expression- Returns:
falseif the encapsulated expression was validated and is invalid;trueotherwise
-
validateBetweenExpression
Description copied from class:AbstractSemanticValidatorValidates 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:
validateBetweenExpressionin classAbstractSemanticValidator- Parameters:
expression- TheBetweenExpressionto 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 givenExpressionis of the correct type based on these rules:- The
Expressionreturns a boolean value; - The
Expression's type is a boolean type.
- Parameters:
expression- TheExpressionto validatemessageKey- The key used to retrieve the localized message describing the problem
- The
-
validateCollectionMemberExpression
Description copied from class:AbstractSemanticValidatorValidates the givenCollectionMemberExpression. Only the collection-valued path expression is validated.- Overrides:
validateCollectionMemberExpressionin classAbstractSemanticValidator- Parameters:
expression- TheCollectionMemberExpressionto 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:AbstractSemanticValidatorValidates 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:
validateComparisonExpressionin classAbstractSemanticValidator- Parameters:
expression- TheConcatExpressionto validate by validating its left and right expressions- Returns:
- The status of the comparison between the left and right expression:
trueif the two expressions pass the rules defined by this method;falseotherwise
- If the comparison operator is either '=' or '<>'. The expressions can only be
-
validateConcatExpression
Description copied from class:AbstractSemanticValidatorValidates the encapsulated expression of the givenCONCATexpression. 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:
validateConcatExpressionin classAbstractSemanticValidator- Parameters:
expression- TheConcatExpressionto validate by validating its encapsulated expression- Returns:
falseif the first encapsulated expression was validated and is invalid;trueotherwise
-
validateConstructorExpression
Description copied from class:AbstractSemanticValidatorValidates the givenConstructorExpression. The default behavior does not require to semantically validate it.- Overrides:
validateConstructorExpressionin classAbstractSemanticValidator- Parameters:
expression- TheConstructorExpressionto validate
-
validateCountFunction
Description copied from class:AbstractSemanticValidatorValidates the givenCountFunction. The default behavior does not require to semantically validate it.- Overrides:
validateCountFunctionin classAbstractSemanticValidator- Parameters:
expression- TheCountFunctionto validate
-
validateEntryExpression
Description copied from class:AbstractSemanticValidatorValidates the givenEntryExpression. The default behavior does not require to semantically validate it.- Overrides:
validateEntryExpressionin classAbstractSemanticValidator- Parameters:
expression- TheEntryExpressionto validate
-
validateIdentificationVariable
protected boolean validateIdentificationVariable(IdentificationVariable expression, String variable) Description copied from class:AbstractSemanticValidatorValidates the given identification variable. The default behavior is to not validate it.- Overrides:
validateIdentificationVariablein classAbstractSemanticValidator- Parameters:
expression- TheIdentificationVariablethat is being visitedvariable- The actual identification variable, which is never an empty string- Returns:
trueif the given identification variable is valid;falseotherwise
-
validateIntegralType
Determines whether the givenExpressionis of the correct type based on these rules:- The
Expressionreturns a integral value; - The
Expression's type is an integral type (long or integer).
- Parameters:
expression- TheExpressionto 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:
falseif the given expression was validated and is invalid;trueotherwise
- The
-
validateKeyExpression
Description copied from class:AbstractSemanticValidatorValidates the givenKeyExpression. The default behavior does not require to semantically validate it.- Overrides:
validateKeyExpressionin classAbstractSemanticValidator- Parameters:
expression- TheKeyExpressionto validate
-
validateLengthExpression
Description copied from class:AbstractSemanticValidatorValidates the encapsulated expression of the givenLENGTHexpression. 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:
validateLengthExpressionin classAbstractSemanticValidator- Parameters:
expression- TheLengthExpressionto validate by validating its encapsulated expression- Returns:
falseif the encapsulated expression was validated and is invalid;trueotherwise
-
validateLocateExpression
Description copied from class:AbstractSemanticValidatorValidates the encapsulated expression of the givenLOCATEexpression. 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:
validateLocateExpressionin classAbstractSemanticValidator- Parameters:
expression- TheLocateExpressionto 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:AbstractSemanticValidatorValidates the encapsulated expression of the givenLOWERexpression. 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:
validateLowerExpressionin classAbstractSemanticValidator- Parameters:
expression- TheLowerExpressionto validate by validating its encapsulated expression- Returns:
falseif the encapsulated expression was validated and is invalid;trueotherwise
-
validateMapIdentificationVariable
protected void validateMapIdentificationVariable(EncapsulatedIdentificationVariableExpression expression) -
validateModExpression
Description copied from class:AbstractSemanticValidatorValidates the encapsulated expression of the givenMODexpression. 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:
validateModExpressionin classAbstractSemanticValidator- Parameters:
expression- TheModExpressionto 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:AbstractSemanticValidatorValidates the givenNotExpression. The default behavior does not require to semantically validate it.- Overrides:
validateNotExpressionin classAbstractSemanticValidator- Parameters:
expression- TheNotExpressionto validate
-
validateNullComparisonExpression
Description copied from class:AbstractSemanticValidatorValidates the givenNullComparisonExpression. The default behavior does not require to semantically validate it.- Overrides:
validateNullComparisonExpressionin classAbstractSemanticValidator- Parameters:
expression- TheNullComparisonExpressionto validate
-
validateNumericType
Determines whether the givenExpressionis of the correct type based on these rules:- The
Expressionreturns a numeric value; - The
Expression's type is an numeric type.
- Parameters:
expression- TheExpressionto validatemessageKey- The key used to retrieve the localized message describing the problem- Returns:
falseif the given expression was validated and is invalid;trueotherwise
- The
-
validateSqrtExpression
Description copied from class:AbstractSemanticValidatorValidates the encapsulated expression of the givenSQRTexpression. 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:
validateSqrtExpressionin classAbstractSemanticValidator- Parameters:
expression- TheSqrtExpressionto validate by validating its encapsulated expression- Returns:
falseif the encapsulated expression was validated and is invalid;trueotherwise
-
validateStringType
Determines whether the givenExpressionis of the correct type based on these rules:- The
Expressionreturns a String value; - The
Expression's type is a String type.
- Parameters:
expression- TheExpressionto validatemessageKey- The key used to retrieve the localized message describing the problem- Returns:
falseif the given expression was validated and is invalid;trueotherwise
- The
-
validateSubstringExpression
Description copied from class:AbstractSemanticValidatorValidates the encapsulated expression of the givenSUBSTRINGexpression. 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:
validateSubstringExpressionin classAbstractSemanticValidator- Parameters:
expression- TheSubstringExpressionto 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:AbstractSemanticValidatorValidates the encapsulated expression of the givenMODexpression. 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:
validateSumFunctionin classAbstractSemanticValidator- Parameters:
expression- TheModExpressionto validate by validating its encapsulated expression- Returns:
falseif the encapsulated expression was validated and is invalid;trueotherwise
-
validateUpdateItem
Description copied from class:AbstractSemanticValidatorValidates the givenUpdateItemby 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:
validateUpdateItemin classAbstractSemanticValidator- Parameters:
expression-UpdateItemto validate its path expression- Returns:
trueif the path expression is valid;falseotherwise
-
validateUpdateItemTypes
-
validateUpperExpression
Description copied from class:AbstractSemanticValidatorValidates the encapsulated expression of the givenUPPERexpression. 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:
validateUpperExpressionin classAbstractSemanticValidator- Parameters:
expression- TheUpperExpressionto validate by validating its encapsulated expression- Returns:
falseif the encapsulated expression was validated and is invalid;trueotherwise
-
validateValueExpression
Description copied from class:AbstractSemanticValidatorValidates the givenValueExpression. The default behavior does not require to semantically validate it.- Overrides:
validateValueExpressionin classAbstractSemanticValidator- Parameters:
expression- TheValueExpressionto validate
-