Public class MvelVarTest {
public static void main(String[] args) {
String expression = "( a > b + 2 ) && ( c < a - 5 )";
ParserContext context = new ParserContext();
Serializable compiledExpression = MVEL.compileExpression(expression, context);
for (Map.Entry<String,Class> entry : context.getInputs().entrySet()) {
System.out.println("Variable name : "+entry.getKey()+", Data Type = "+entry.getValue().toString());
}
Map values = new HashMap();
values.put("a",25);
values.put("b",20);
values.put("c",10);
System.out.println("Result of running formula with (a=25, b=20, c=10) = "+MVEL.executeExpression(compiledExpression,values,Boolean.class));
}