use of org.thymeleaf.standard.expression.Assignation 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 Configuration configuration = arguments.getConfiguration();
final IStandardExpressionParser expressionParser = StandardExpressions.getExpressionParser(configuration);
final AssignationSequence assignationSequence = AssignationUtils.parseAssignationSequence(configuration, arguments, attributeValue, false);
for (final Assignation assignation : assignationSequence.getAssignations()) {
final IStandardExpression varNameExpr = assignation.getLeft();
final IStandardExpression varValueExpr = assignation.getRight();
final Object varName = varNameExpr.execute(configuration, arguments);
final Object varValue = varValueExpr.execute(configuration, arguments);
element.setNodeLocalVariable((varName == null ? null : varName.toString()), varValue);
}
element.removeAttribute(attributeName);
return ProcessorResult.OK;
}
use of org.thymeleaf.standard.expression.Assignation 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 Configuration configuration = arguments.getConfiguration();
final AssignationSequence assignationSequence = AssignationUtils.parseAssignationSequence(configuration, arguments, attributeValue, false);
final Map<String, Object> localVariables = new HashMap<String, Object>();
for (final Assignation assignation : assignationSequence.getAssignations()) {
final IStandardExpression varNameExpr = assignation.getLeft();
final IStandardExpression varValueExpr = assignation.getRight();
final Object varName = varNameExpr.execute(configuration, arguments);
final Object varValue = varValueExpr.execute(configuration, arguments);
localVariables.put((varName == null ? null : varName.toString()), varValue);
}
element.removeAttribute(attributeName);
return ProcessorResult.setLocalVariables(localVariables);
}
use of org.thymeleaf.standard.expression.Assignation 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 Configuration configuration = arguments.getConfiguration();
final IStandardExpressionParser expressionParser = StandardExpressions.getExpressionParser(configuration);
final AssignationSequence assignationSequence = AssignationUtils.parseAssignationSequence(configuration, arguments, attributeValue, false);
for (final Assignation assignation : assignationSequence.getAssignations()) {
final IStandardExpression varNameExpr = assignation.getLeft();
final IStandardExpression varValueExpr = assignation.getRight();
final Object varName = varNameExpr.execute(configuration, arguments);
final Object varValue = varValueExpr.execute(configuration, arguments);
element.setNodeLocalVariable((varName == null ? null : varName.toString()), varValue);
}
element.removeAttribute(attributeName);
return ProcessorResult.OK;
}
Aggregations