private static AssignationSequence createSyntheticallyNamedParameterSequence(final ExpressionSequence expSeq) { final List<Assignation> assignations = new ArrayList<Assignation>(expSeq.size() + 2); int argIndex = 0; for (final IStandardExpression expression : expSeq.getExpressions()) { final IStandardExpression parameterName = Expression.parse(TextLiteralExpression.wrapStringIntoLiteral(UNNAMED_PARAMETERS_PREFIX + argIndex++)); assignations.add(new Assignation(parameterName, expression)); } return new AssignationSequence(assignations); }
final List<IStandardExpression> parameterExpressionValues = parameterExpressionSequence.getExpressions(); final int parameterExpressionValuesLen = parameterExpressionValues.size();
@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()); } } }
private static AssignationSequence createSyntheticallyNamedParameterSequence(final ExpressionSequence expSeq) { final List<Assignation> assignations = new ArrayList<Assignation>(expSeq.size() + 2); int argIndex = 0; for (final IStandardExpression expression : expSeq.getExpressions()) { final IStandardExpression parameterName = Expression.parse(TextLiteralExpression.wrapStringIntoLiteral(UNNAMED_PARAMETERS_PREFIX + argIndex++)); assignations.add(new Assignation(parameterName, expression)); } return new AssignationSequence(assignations); }
@Override protected final void checkAssertions(final Arguments arguments, final Element element, final String attributeName, final String attributeValue) { if (StringUtils.isEmptyOrWhitespace(attributeValue)) { return; } final Configuration configuration = arguments.getConfiguration(); final ExpressionSequence expressionSequence = ExpressionSequenceUtils.parseExpressionSequence(configuration, arguments, attributeValue); final List<IStandardExpression> expressions = expressionSequence.getExpressions(); for (final IStandardExpression expression : expressions) { final Object expressionResult = expression.execute(arguments.getConfiguration(), arguments); final boolean expressionBooleanResult = EvaluationUtil.evaluateAsBoolean(expressionResult); if (!expressionBooleanResult) { throw new TemplateAssertionException(expression.getStringRepresentation(), arguments.getTemplateName(), element.getLineNumber()); } } }