Java Code Examples for org.springframework.expression.common.CompositeStringExpression

The following examples show how to use org.springframework.expression.common.CompositeStringExpression. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: springlets   Source File:    License: Apache License 2.0 6 votes vote down vote up
private void registerConversionServiceInSpelExpressions(Expression parsedExpression) {
  if (conversionService == null) {
  StandardTypeConverter converter = new StandardTypeConverter(conversionService);
  StandardEvaluationContext context = new StandardEvaluationContext();
  setContextIfSpelExpression(parsedExpression, context);

  if (parsedExpression instanceof CompositeStringExpression) {
    CompositeStringExpression composite = (CompositeStringExpression) parsedExpression;
    for (Expression childExpresion : composite.getExpressions()) {
      setContextIfSpelExpression(childExpresion, context);
Example 2
Source Project: spring-cloud-gcp   Source File:    License: Apache License 2.0 5 votes vote down vote up
private Expression[] detectExpressions(String sql) {
	Expression expression = this.expressionParser.parseExpression(sql,
	if (expression instanceof LiteralExpression) {
		return new Expression[] { expression };
	else if (expression instanceof CompositeStringExpression) {
		return ((CompositeStringExpression) expression).getExpressions();
	else {
		throw new SpannerDataException("Unexpected expression type. "
				+ "Query can either contain no SpEL expressions or have SpEL expressions in the SQL.");
Example 3
Source Project: kork   Source File:    License: Apache License 2.0 5 votes vote down vote up
/** Helper to escape an expression: stripping ${ } */
private String escapeExpression(Expression expression) {
  if (expression instanceof CompositeStringExpression) {
    StringBuilder sb = new StringBuilder();
    for (Expression e : ((CompositeStringExpression) expression).getExpressions()) {

    return sb.toString();

  return expression.getExpressionString();