use of org.thymeleaf.standard.expression.Expression in project thymeleaf-tests by thymeleaf.
the class AddLocalVariableToNode method processAttribute.
@Override
protected ProcessorResult processAttribute(final Arguments arguments, final Element element, final String attributeName) {
final String attributeValue = element.getAttributeValue(attributeName);
final AssignationSequence assignationSequence = StandardExpressionProcessor.parseAssignationSequence(arguments, attributeValue, false);
for (final Assignation assignation : assignationSequence.getAssignations()) {
final String varName = assignation.getLeft().getValue();
final Expression varValueExpr = assignation.getRight();
final Object varValue = StandardExpressionProcessor.executeExpression(arguments, varValueExpr);
element.setNodeLocalVariable(varName, varValue);
}
element.removeAttribute(attributeName);
return ProcessorResult.OK;
}
use of org.thymeleaf.standard.expression.Expression in project thymeleaf-tests by thymeleaf.
the class AddLocalVariableToResult method processAttribute.
@Override
protected ProcessorResult processAttribute(final Arguments arguments, final Element element, final String attributeName) {
final String attributeValue = element.getAttributeValue(attributeName);
final AssignationSequence assignationSequence = StandardExpressionProcessor.parseAssignationSequence(arguments, attributeValue, false);
final Map<String, Object> localVariables = new HashMap<String, Object>();
for (final Assignation assignation : assignationSequence.getAssignations()) {
final String varName = assignation.getLeft().getValue();
final Expression varValueExpr = assignation.getRight();
final Object varValue = StandardExpressionProcessor.executeExpression(arguments, varValueExpr);
localVariables.put(varName, varValue);
}
element.removeAttribute(attributeName);
return ProcessorResult.setLocalVariables(localVariables);
}
Aggregations