syntheticAttributes.add(new AttrImpl(pair.first(), value));
@Override protected Object doExec(Element element, Object scope, String expression, Object... arguments) throws TemplateException { if (expression.isEmpty()) { throw new TemplateException("Invalid CSS_CLASS operand. Expression is empty."); } CssClass cssClass = new CssClass(element); PairsList pairs = new PairsList(expression); for (Pair pair : pairs) { // accordingly CSS_CLASS operator syntax first pair value is a conditional expression and the second is the CSS // class name ConditionalExpression conditionalExpression = new ConditionalExpression(content, scope, pair.first()); String className = pair.second(); if (conditionalExpression.value()) { log.debug("True conditional expression |%s|. Add CSS class |%s| to element |%s|.", pair.first(), className, element.trace()); cssClass.add(className); } else { log.debug("False conditional expression |%s|. Remove CSS class |%s| from element |%s|.", pair.first(), className, element.trace()); cssClass.remove(className); } } return cssClass; } }