Examples of ExpressionVariable


Examples of org.springframework.binding.expression.ExpressionVariable

  }

  public void testTemplateNestedVariables() {
    String expressionString = "#{value}#{max}";
    Expression exp = parser.parseExpression(expressionString, new FluentParserContext().template().variable(
        new ExpressionVariable("max", "#{maximum}#{var}", new FluentParserContext().template().variable(
            new ExpressionVariable("var", "'bar'")))));
    TestBean target = new TestBean();
    assertEquals("foo2bar", exp.getValue(target));
  }
View Full Code Here

Examples of org.springframework.binding.expression.ExpressionVariable

    parser.parseExpression("${b,#{1:2}}", new FluentParserContext().template());
    parser.parseExpression("a${b,#{1:2},e}f${g,#{3:4},j}k", new FluentParserContext().template());
  }

  public void testVariables() {
    Expression exp = parser.parseExpression("#var", new FluentParserContext().variable(new ExpressionVariable(
        "var", "flag")));
    assertEquals(false, ((Boolean) exp.getValue(bean)).booleanValue());
  }
View Full Code Here

Examples of org.springframework.binding.expression.ExpressionVariable

        "var", "flag")));
    assertEquals(false, ((Boolean) exp.getValue(bean)).booleanValue());
  }

  public void testVariablesWithCoersion() {
    Expression exp = parser.parseExpression("#var", new FluentParserContext().variable(new ExpressionVariable(
        "var", "number", new FluentParserContext().expectResult(Long.class))));
    assertEquals(new Long(0), exp.getValue(bean));
  }
View Full Code Here

Examples of org.springframework.binding.expression.ExpressionVariable

        "var", "number", new FluentParserContext().expectResult(Long.class))));
    assertEquals(new Long(0), exp.getValue(bean));
  }

  public void testNestedVariablesWithTemplates() {
    Expression exp = parser.parseExpression("#var", new FluentParserContext().variable(new ExpressionVariable(
        "var", "${flag}${#var}", new FluentParserContext().template().variable(
            new ExpressionVariable("var", "number")))));
    assertEquals("false0", exp.getValue(bean));
  }
View Full Code Here

Examples of org.springframework.binding.expression.ExpressionVariable

    public void mapVariables(ExpressionVariable[] variables, ExpressionFactory expressionFactory) {
      if (variables != null && variables.length > 0) {
        variableMapper = new VariableMapperImpl();
        for (int i = 0; i < variables.length; i++) {
          ExpressionVariable var = variables[i];
          ParserContext context = var.getParserContext() != null ? var.getParserContext()
              : NullParserContext.INSTANCE;
          ValueExpression expr;
          if (context.isTemplate()) {
            expr = parseValueExpression(var.getValueExpression(), context);
          } else {
            assertNotDelimited(var.getValueExpression());
            assertHasText(var.getValueExpression());
            expr = parseValueExpression("#{" + var.getValueExpression() + "}", context);
          }
          variableMapper.setVariable(var.getName(), expr);
        }
      }
    }
View Full Code Here

Examples of org.springframework.binding.expression.ExpressionVariable

  }

  public void testParseTemplateExpressionWithVariables() {
    String expressionString = "#{value}#{max}";
    Expression exp = parser.parseExpression(expressionString,
        new FluentParserContext().template().variable(new ExpressionVariable("max", "maximum")));
    TestBean target = new TestBean();
    assertEquals("foo2", exp.getValue(target));
  }
View Full Code Here

Examples of org.springframework.binding.expression.ExpressionVariable

    TestBean target = new TestBean();
    assertEquals("foo2", exp.getValue(target));
  }

  public void testVariablesWithCoersion() {
    Expression exp = parser.parseExpression("max", new FluentParserContext().variable(new ExpressionVariable("max",
        "maximum", new FluentParserContext().expectResult(Long.class))));
    TestBean target = new TestBean();
    assertEquals(new Long(2), exp.getValue(target));
  }
View Full Code Here

Examples of org.springframework.binding.expression.ExpressionVariable

  public void testTemplateNestedVariables() {
    String expressionString = "#{value}#{max}";
    Expression exp = parser.parseExpression(
        expressionString,
        new FluentParserContext().template().variable(
            new ExpressionVariable("max", "#{maximum}#{var}", new FluentParserContext().template()
                .variable(new ExpressionVariable("var", "'bar'")))));
    TestBean target = new TestBean();
    assertEquals("foo2bar", exp.getValue(target));
  }
View Full Code Here

Examples of org.springframework.binding.expression.ExpressionVariable

  }

  public void testParseTemplateExpressionWithVariables() {
    String expressionString = "#{value}#{#max}";
    Expression exp = parser.parseExpression(expressionString,
        new FluentParserContext().template().variable(new ExpressionVariable("max", "maximum")));
    TestBean target = new TestBean();
    assertEquals("foo2", exp.getValue(target)); // TODO:
  }
View Full Code Here

Examples of org.springframework.binding.expression.ExpressionVariable

    parser.parseExpression("a${b,#{1:2},e}f${g,#{3:4},j}k", new FluentParserContext().template());
  }

  public void testVariables() {
    Expression exp = parser.parseExpression("#var",
        new FluentParserContext().variable(new ExpressionVariable("var", "flag")));
    assertFalse((Boolean) exp.getValue(bean));
  }
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.