Examples of SpelExpressionParser


Examples of org.springframework.expression.spel.standard.SpelExpressionParser

    }

    StandardEvaluationContext evalContext = new StandardEvaluationContext();
    evalContext.setVariable(ENTITY_NAME, metadata.getEntityName());

    SpelExpressionParser parser = new SpelExpressionParser();
    Expression expr = parser.parseExpression(query, ParserContext.TEMPLATE_EXPRESSION);

    Object result = expr.getValue(evalContext, String.class);
    return result == null ? query : String.valueOf(result);
  }
View Full Code Here

Examples of org.springframework.expression.spel.standard.SpelExpressionParser

   *
   * @param expressionString
   * @return
   */
  protected Expression parseExpressionString(String expressionString) {
    return new SpelExpressionParser().parseExpression(expressionString);
  }
View Full Code Here

Examples of org.springframework.expression.spel.standard.SpelExpressionParser

  @Test
  public void repro() {
    StandardEvaluationContext context = new StandardEvaluationContext();
    context.setBeanResolver(new MyBeanResolver());
    Expression expr = new SpelExpressionParser().parseRaw("@dummyAction.isZero(@dummyBean.getCalls())");
    boolean value = expr.getValue(context, boolean.class);
    System.out.println(value);
  }
View Full Code Here

Examples of org.springframework.expression.spel.standard.SpelExpressionParser

  @Autowired
  private BeanFactory beanFactory;

  @Test
  public void testBytesNotCopied() throws Exception {
    Expression expression = new SpelExpressionParser().parseExpression("@service.handleBytes(#root)");
    byte[] bytes = new byte[100];
    StandardEvaluationContext evaluationContext = new StandardEvaluationContext(bytes);
    evaluationContext.setBeanResolver(new BeanFactoryResolver(this.beanFactory));
    byte[] outBytes = expression.getValue(evaluationContext, byte[].class);
    assertSame(bytes, outBytes);
View Full Code Here

Examples of org.springframework.expression.spel.standard.SpelExpressionParser

*/
public class ReproTests {

  @Test
  public void spr11494() {
    Expression exp = new SpelExpressionParser().parseExpression("T(java.util.Arrays).asList('a','b')");
    List<String> list = (List<String>) exp.getValue();
    assertThat(list.size(), is(2));
  }
View Full Code Here

Examples of org.springframework.expression.spel.standard.SpelExpressionParser

    if (beanFactory != null) {
      evaluationContext.setBeanResolver(new BeanFactoryResolver(beanFactory));
    }

    this.evaluationContext = evaluationContext;
    this.parser = new SpelExpressionParser();
    this.parserContext = new TemplateParserContext();
    this.delegate = delegate;
  }
View Full Code Here

Examples of org.springframework.expression.spel.standard.SpelExpressionParser

        HttpHeaders headers = new HttpHeaders();
        if (!accessToken.equals(token)) {
            headers.set("Status", "403 Forbidden");
            return new HttpEntity<>("{ \"message\": \"Forbidden\" }\n", headers);
        }
        SpelExpressionParser parser = new SpelExpressionParser();
        Expression spel = parser.parseExpression(template, new TemplateParserContext());

        Map<?, ?> push;
        try {
            push = this.objectMapper.readValue(payload, Map.class);
            logger.info("Recieved new webhook payload for push with head_commit message: "
View Full Code Here

Examples of org.springframework.expression.spel.standard.SpelExpressionParser

  /**
   * Create a new {@code StandardBeanExpressionResolver} with default settings.
   */
  public StandardBeanExpressionResolver() {
    this.expressionParser = new SpelExpressionParser();
  }
View Full Code Here

Examples of org.springframework.expression.spel.standard.SpelExpressionParser

   * Create a new {@code StandardBeanExpressionResolver} with the given bean class loader,
   * using it as the basis for expression compilation.
   * @param beanClassLoader the factory's bean class loader
   */
  public StandardBeanExpressionResolver(ClassLoader beanClassLoader) {
    this.expressionParser = new SpelExpressionParser(new SpelParserConfiguration(null, beanClassLoader));
  }
View Full Code Here

Examples of org.springframework.expression.spel.standard.SpelExpressionParser

  }

  @Test
  public void withReturnValue() throws Exception {
    EvaluationContext context = createEvaluationContext("theResult");
    Object value = new SpelExpressionParser().parseExpression("#result").getValue(context);
    assertThat(value, equalTo((Object) "theResult"));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.