WhereValidator
Overview
The WhereValidator class checks WhereExpressions for errors. The main purpose of this class is to scan all objects of the WhereExpession tree and to make sure that it contains valid field names.
Location
- Reference: com.remobjects.dataabstract.jar
- Package: com.remobjects.dataabstract.expressions
- Ancestry: Object | WhereVisitor | WhereValidator
Instance Methods
constructor
Empty constructor that creates an instance of the WhereValidator.
constructor
WhereValidator()
validate
Scans all objects of the WhereExpression tree for errors, using the Visit method of the parent WhereVisitor class.
method validate(anExpression: WhereExpression; allowedFieldNames: array of String; anErrors: ReferenceType<String>): Integer
Integer validate(WhereExpression anExpression, String[] allowedFieldNames, ReferenceType<String> anErrors)
Parameters:
- anExpression: The instance of where expression that is to be validate.
- allowedFieldNames: The array of allowed field names for the given expression.
- anErrors: The reference paramether whose value holds validatoin errors, if they were found during validation.
visit protected (declared in WhereVisitor)
method visit(expression: WhereExpression): WhereExpression
WhereExpression visit(WhereExpression expression)
Parameters:
- expression:
visitBetween protected (declared in WhereVisitor)
Defines the base rule of traversal for BetweenExpression. First, it visits Expression, then Lower Expression and finally Upper Expression. If parts of BetweenExpression were changed during visits, a new BetweenExpression, containing the new parts, will be obtained as a result.
method visitBetween(anExpression: BetweenExpression): WhereExpression
WhereExpression visitBetween(BetweenExpression anExpression)
Parameters:
- anExpression: The given between expresion to visit.
visitBinary protected (declared in WhereVisitor)
Defines the base rule of traversal for BinaryExpression. First, it visits Left Expression, then Right Expression. If parts of BinaryExpression were changed during visits, a new BinaryExpression, containing the new parts, will be obtained.
method visitBinary(anExpression: BinaryExpression): WhereExpression
WhereExpression visitBinary(BinaryExpression anExpression)
Parameters:
- anExpression: The given binaryexpresion to visit.
visitConstant protected (declared in WhereVisitor)
Defines the base rule of traversal for ConstantExpressions. Since ConstantExpressions can't consist of other expressions (it's the final object in the WhereExpression tree), this method returns the given ConstantExpression.
method visitConstant(anExpression: ConstantExpression): WhereExpression
WhereExpression visitConstant(ConstantExpression anExpression)
Parameters:
- anExpression: The given constant expresion to visit.
visitDateTimeNow protected (declared in WhereVisitor)
method visitDateTimeNow(expression: DateTimeNowExpression): WhereExpression
WhereExpression visitDateTimeNow(DateTimeNowExpression expression)
Parameters:
- expression:
visitDateTimePart protected (declared in WhereVisitor)
method visitDateTimePart(expression: DateTimePartExpression): WhereExpression
WhereExpression visitDateTimePart(DateTimePartExpression expression)
Parameters:
- expression:
visitDateTimeToday protected (declared in WhereVisitor)
method visitDateTimeToday(expression: DateTimeTodayExpression): WhereExpression
WhereExpression visitDateTimeToday(DateTimeTodayExpression expression)
Parameters:
- expression:
visitField protected
Overloaded method that will be called for each FieldExpression contained in the test WhereExpression. It validates that the FieldExpression.FieldName is one of the allowedFieldNames
given through the Validate method. Otherwise it adds an error message to the error list, which will be returned as refference parameter of the Validate method.
method visitField(anExpression: FieldExpression): WhereExpression
WhereExpression visitField(FieldExpression anExpression)
Parameters:
- anExpression: The field expression to be validated.
visitFunctionCall protected (declared in WhereVisitor)
method visitFunctionCall(expression: FunctionCallExpression): WhereExpression
WhereExpression visitFunctionCall(FunctionCallExpression expression)
Parameters:
- expression:
visitList protected (declared in WhereVisitor)
Defines the base rule of traversal for ListExpressions. This method goes through the list and visits every expression on it. If at least one expression on the list was changed during the visit, a new ListExpression, containing the changed items, will be obtained as a result.
method visitList(anExpression: ListExpression): WhereExpression
WhereExpression visitList(ListExpression anExpression)
Parameters:
- anExpression: The given list expresion to visit.
visitMacro protected (declared in WhereVisitor)
Defines the base rule of traversal for MacroExpressions. This method goes through the items list and visits every expression on it. If at least one expression on the list was changed during the visit, a new MacroExpression, containing the changed items, will be obtained as a result.
method visitMacro(anExpression: MacroExpression): WhereExpression
WhereExpression visitMacro(MacroExpression anExpression)
Parameters:
- anExpression: The given macro expresion to visit.
visitNull protected (declared in WhereVisitor)
Defines the base rule of traversal for NullExpressions. Since NullExpression can't consist of other expressions, this method returns the given expression.
method visitNull(anExpression: NullExpression): WhereExpression
WhereExpression visitNull(NullExpression anExpression)
Parameters:
- anExpression: The given null expresion to visit.
visitParameter protected (declared in WhereVisitor)
Defines the base rule of traversal for ParameterExpressions. Since ParameterExpression can't consist of other expressions (it's the final object in the WhereExpression tree), this method returns the given ParameterExpression.
method visitParameter(anExpression: ParameterExpression): WhereExpression
WhereExpression visitParameter(ParameterExpression anExpression)
Parameters:
- anExpression: The given parameter expresion to visit.
visitUnary protected
Overloaded method that will be called for each UnaryExpression contained in the test WhereExpression. It checks if the UnaryExpression.Expression is a BinaryExpression, otherwise it adds an error message to the error list, which will be returned as out parameter of the Validate method.
method visitUnary(anExpression: UnaryExpression): WhereExpression
WhereExpression visitUnary(UnaryExpression anExpression)
Parameters:
- anExpression: The unary expression to be validated.