final IStandardExpressionParser expressionParser = StandardExpressions.getExpressionParser(configuration);
final IStandardExpression expressionObj =
expressionParser.parseExpression(configuration, processingContext, expression);
if (expressionObj == null) {
throw new TemplateProcessingException(
"Expression \"" + expression + "\" is not valid: cannot perform Spring bind");
}
if (expressionObj instanceof SelectionVariableExpression) {
final String bindExpression = ((SelectionVariableExpression)expressionObj).getExpression();
return getBindStatusFromParsedExpression(configuration, processingContext, optional, true, bindExpression);
}
if (expressionObj instanceof VariableExpression) {
final String bindExpression = ((VariableExpression)expressionObj).getExpression();
return getBindStatusFromParsedExpression(configuration, processingContext, optional, false, bindExpression);
}
throw new TemplateProcessingException(
"Expression \"" + expression + "\" is not valid: only variable expressions ${...} or " +
"selection expressions *{...} are allowed in Spring field bindings");
}