Lets assume a
, b
are integers, and pets is of type HashMap<String, Integer>
When I pre-compile the expression below, the pets.containsKey(\"Dogs\")
node is a null inside the CompiledExpression object.
CompiledExpression compiledExpression = new ExpressionCompiler("a > 0 && b > 0 && pets.containsKey(\"Dogs\")").compile();
return (boolean) MVEL.executeExpression(compiledExpression, params);
However, when I do something like
boolean res = (boolean) MVEL.eval("a > 0 && b > 0 && pets.containsKey(\"Dogs\")", params);
It works just fine and I get the appropriate response back.
Is there any way to precompile an expression that contains an object like a hashmap?