Package org.springframework.expression

Examples of org.springframework.expression.ExpressionParser


  }

  @Test
  public void SPR9486_floatGreaterThanDouble() {
    Boolean expectedResult = -10.21f > -10.2;
    ExpressionParser parser = new SpelExpressionParser();
    StandardEvaluationContext context = new StandardEvaluationContext();
    Expression expression = parser.parseExpression("-10.21f > -10.2");
    Boolean result = expression.getValue(context, null, Boolean.class);
    assertEquals(expectedResult, result);
  }
View Full Code Here


  }

  @Test
  public void SPR9486_floatGreaterThanOrEqualFloat() {
    Boolean expectedNumber = -10.21f >= -10.2f;
    ExpressionParser parser = new SpelExpressionParser();
    StandardEvaluationContext context = new StandardEvaluationContext();
    Expression expression = parser.parseExpression("-10.21f >= -10.2f");
    Boolean result = expression.getValue(context, null, Boolean.class);
    assertEquals(expectedNumber, result);
  }
View Full Code Here

  }

  @Test
  public void SPR9486_floatGreaterThanEqualDouble() {
    Boolean expectedResult = -10.21f >= -10.2;
    ExpressionParser parser = new SpelExpressionParser();
    StandardEvaluationContext context = new StandardEvaluationContext();
    Expression expression = parser.parseExpression("-10.21f >= -10.2");
    Boolean result = expression.getValue(context, null, Boolean.class);
    assertEquals(expectedResult, result);
  }
View Full Code Here

  }

  @Test
  public void SPR9486_floatModulusFloat() {
    Number expectedResult = 10.21f % 10.2f;
    ExpressionParser parser = new SpelExpressionParser();
    StandardEvaluationContext context = new StandardEvaluationContext();
    Expression expression = parser.parseExpression("10.21f % 10.2f");
    Number result = expression.getValue(context, null, Number.class);
    assertEquals(expectedResult, result);
  }
View Full Code Here

  }

  @Test
  public void SPR9486_floatModulusDouble() {
    Number expectedResult = 10.21f % 10.2;
    ExpressionParser parser = new SpelExpressionParser();
    StandardEvaluationContext context = new StandardEvaluationContext();
    Expression expression = parser.parseExpression("10.21f % 10.2");
    Number result = expression.getValue(context, null, Number.class);
    assertEquals(expectedResult, result);
  }
View Full Code Here

  }

  @Test
  public void SPR9486_floatPowerFloat() {
    Number expectedResult = Math.pow(10.21f, -10.2f);
    ExpressionParser parser = new SpelExpressionParser();
    StandardEvaluationContext context = new StandardEvaluationContext();
    Expression expression = parser.parseExpression("10.21f ^ -10.2f");
    Number result = expression.getValue(context, null, Number.class);
    assertEquals(expectedResult, result);
  }
View Full Code Here

  }

  @Test
  public void SPR9486_floatPowerDouble() {
    Number expectedResult = Math.pow(10.21f, 10.2);
    ExpressionParser parser = new SpelExpressionParser();
    StandardEvaluationContext context = new StandardEvaluationContext();
    Expression expression = parser.parseExpression("10.21f ^ 10.2");
    Number result = expression.getValue(context, null, Number.class);
    assertEquals(expectedResult, result);
  }
View Full Code Here

    assertEquals(Integer.class, value.getTypeDescriptor().getType());
  }

  @Test
  public void SPR10091_simpleTestValueType() {
    ExpressionParser parser = new SpelExpressionParser();
    StandardEvaluationContext evaluationContext = new StandardEvaluationContext(new BooleanHolder());
    Class<?> valueType = parser.parseExpression("simpleProperty").getValueType(evaluationContext);
    assertNotNull(valueType);
  }
View Full Code Here

  private static PartitionStrategy parsePartitionExpression(String expression) {

    List<String> expressions = Arrays.asList(expression.split("/"));

    ExpressionParser parser = new SpelExpressionParser();
    PartitionStrategy.Builder psb = new PartitionStrategy.Builder();
    StandardEvaluationContext ctx = new StandardEvaluationContext(psb);
    for (String expr : expressions) {
      try {
        Expression e = parser.parseExpression(expr);
        psb = e.getValue(ctx, PartitionStrategy.Builder.class);
      }
      catch (SpelParseException spe) {
        if (!expr.trim().endsWith(")")) {
          throw new StoreException("Invalid partitioning expression '" + expr
View Full Code Here

   */
  public static String spelParser(String expressionStr,
      Map<String, Object> params, ParserContext parserContext) {
    StandardEvaluationContext context = new StandardEvaluationContext(
        params);
    ExpressionParser spel = new SpelExpressionParser();
    return spel.parseExpression(expressionStr, parserContext).getValue(
        context, String.class);
  }// ;
View Full Code Here

TOP

Related Classes of org.springframework.expression.ExpressionParser

Copyright © 2018 www.massapicom. 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.