Skip to content

Commit

Permalink
add validation
Browse files Browse the repository at this point in the history
  • Loading branch information
sidhant92 committed Aug 25, 2024
1 parent ea04bd8 commit 1d093c9
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ public boolean evaluateLogicalOperator(final Operator operator, final ContainerD
if (!containerDataType.isValid(leftOperandDataType, leftOperand)) {
throw new InvalidDataType(String.format("Validation failed for the operator %s for the operand %s", operator, leftOperand));
}
rightOperands.forEach(rightOperand -> {
if (!abstractOperator.getAllowedDataTypes().contains(rightOperand.getRight())) {
throw new InvalidDataType(String.format("Invalid right operand data type %s for operator %s", rightOperand.getRight(), operator));
}
});
return OperatorFactory.getLogicalOperator(operator).evaluate(containerDataType, leftOperand, leftOperandDataType, rightOperands);
}

Expand Down

0 comments on commit 1d093c9

Please sign in to comment.