Package de.odysseus.el

Examples of de.odysseus.el.ExpressionFactoryImpl.createValueExpression()


    ExpressionFactory factory = new ExpressionFactoryImpl();

    SimpleContext context = new SimpleContext();

    // variables e, pi
    context.setVariable("e", factory.createValueExpression(Math.E, double.class));
    context.setVariable("pi", factory.createValueExpression(Math.PI, double.class));
   
    // functions sin, cos, tan, exp, log, abs, sqrt, min, max, pow
    context.setFunction("", "sin", Math.class.getMethod("sin", double.class));
    context.setFunction("", "cos", Math.class.getMethod("cos", double.class));
View Full Code Here


    SimpleContext context = new SimpleContext();

    // variables e, pi
    context.setVariable("e", factory.createValueExpression(Math.E, double.class));
    context.setVariable("pi", factory.createValueExpression(Math.PI, double.class));
   
    // functions sin, cos, tan, exp, log, abs, sqrt, min, max, pow
    context.setFunction("", "sin", Math.class.getMethod("sin", double.class));
    context.setFunction("", "cos", Math.class.getMethod("cos", double.class));
    context.setFunction("", "tan", Math.class.getMethod("tan", double.class));
View Full Code Here

        System.out.println("> Good bye.");
        System.exit(0);
      }
      try {
        ValueExpression expr =
          factory.createValueExpression(context, "${" + line + "}", Object.class);
        if (line.matches("m[0-9]*")) { // "save to memory"
          expr.setValue(context, display);
        } else {
          display = expr.getValue(context);
        }
View Full Code Here

        "${'abab' ~ '(ba)*'}"
    };

    SimpleContext context = new SimpleContext();
    for (String expression : expressions) {
      ValueExpression e = factory.createValueExpression(context, expression, boolean.class);
      System.out.println(expression + " --> " + e.getValue(context));
    }
  }
}
View Full Code Here

    // our expression we want to evaluate
    String expression = "${varargs:format('Hey %s','Joe')}";

    // let's go...
    ValueExpression e = f.createValueExpression(context, expression, String.class);
    System.out.println(e.getValue(context)); // --> Hey Joe
  }
}
View Full Code Here

    ELContext context = new SimpleContext(resolver);

    // let's go...
    ValueExpression e = null;
   
    e = f.createValueExpression(context, "${'foo'.matches('foo|bar')}", boolean.class);
    System.out.println(e.getValue(context)); // --> true
   
    e = f.createValueExpression(context, "${'bar'.toUpperCase()}", String.class);
    System.out.println(e.getValue(context)); // --> BAR
   
View Full Code Here

    ValueExpression e = null;
   
    e = f.createValueExpression(context, "${'foo'.matches('foo|bar')}", boolean.class);
    System.out.println(e.getValue(context)); // --> true
   
    e = f.createValueExpression(context, "${'bar'.toUpperCase()}", String.class);
    System.out.println(e.getValue(context)); // --> BAR
   
    e = f.createValueExpression(context, "${'foobar '.trim().length()}", int.class);
    System.out.println(e.getValue(context)); // --> 6
  }
View Full Code Here

    System.out.println(e.getValue(context)); // --> true
   
    e = f.createValueExpression(context, "${'bar'.toUpperCase()}", String.class);
    System.out.println(e.getValue(context)); // --> BAR
   
    e = f.createValueExpression(context, "${'foobar '.trim().length()}", int.class);
    System.out.println(e.getValue(context)); // --> 6
  }
}
View Full Code Here

    // create our context
    ELContext context = new SimpleContext();

    // create our expression we want to evaluate
    ValueExpression e = f.createValueExpression(context, "${map[null]}", String.class);

    // create a map containing a value for key <code>null</code> and make it available
    Map<String, String> map = new HashMap<String, String>();
    map.put(null, "foo");
    context.getELResolver().setValue(context, null, "map", map);
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.