use of org.thymeleaf.exceptions.TemplateAssertionException in project thymeleaf by thymeleaf.
the class AbstractStandardAssertionTagProcessor method doProcess.
@Override
protected final void doProcess(final ITemplateContext context, final IProcessableElementTag tag, final AttributeName attributeName, final String attributeValue, final IElementTagStructureHandler structureHandler) {
if (StringUtils.isEmptyOrWhitespace(attributeValue)) {
return;
}
final ExpressionSequence expressionSequence = ExpressionSequenceUtils.parseExpressionSequence(context, attributeValue);
final List<IStandardExpression> expressions = expressionSequence.getExpressions();
for (final IStandardExpression expression : expressions) {
final Object expressionResult = expression.execute(context);
final boolean expressionBooleanResult = EvaluationUtils.evaluateAsBoolean(expressionResult);
if (!expressionBooleanResult) {
throw new TemplateAssertionException(expression.getStringRepresentation(), tag.getTemplateName(), tag.getAttribute(attributeName).getLine(), tag.getAttribute(attributeName).getCol());
}
}
}
Aggregations