ELFunction implements PartitionFunction { public Integer execute(String columnValue, Map<String, Object> extension) { Map<String, Object> vrs = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<String, Object>(); params.put("value", columnValue); vrs.put("$ROOT", params); VariableResolverFactory vrfactory = new MapVariableResolverFactory(vrs); return MVEL.eval(expression, params, vrfactory, Integer.class); }  Integer execute(String columnValue, Map<String, Object> extension); void setExpression(String expression); @Override String toString();  }
@Test public void testExecute() throws Exception { ELFunction rule = new ELFunction(); rule.setExpression("user_id % 4"); Object result = rule.execute("1", null); System.out.println(result); }