Expression { public Set<String> analysisInputs(String expression) { ParserContext pCtx = ParserContext.create(); MVEL.analysisCompile(expression, pCtx); Map<String, Class> inputsMap = pCtx.getInputs(); return inputsMap.keySet(); } Expression(ExpressionContext context); Object eval(String expression); Object eval(String expression, Map<String, Object> vars); Object compile(String expression, ExpressionContext pctx); Set<String> analysisInputs(String expression);  }
@Test public void testAnalysisInputs() { String expr = " a && b "; Set<String> inputs = expression.analysisInputs(expr); assertThat(inputs.size(), is(2)); assertThat(inputs, is(Sets.newHashSet("a", "b"))); }