代码拉取完成,页面将自动刷新
基于类sql的表达式引擎,可判断where后的逻辑
表达式引擎支持的运算符:
支持组合与优先级:
表达式书写要求:
使用示例:
// 测试 startWith endWith
Map<String, Object> map= new HashMap<>();
map.put("a", "123456");
map.put("b", "5");
map.put("c", "2");
map.put("d", null);
Expression exp= ExpressionParser.fromString("c endWith '2' and (a startWith '123' OR b != '5')");
boolean b = exp.interpret(map);
System.out.println("exp match result [true]:" + b);
// 测试 in
map= new HashMap<>();
map.put("a", 1);
Expression exp2 = ExpressionParser.fromString("a in (1,2,3)");
b = exp2.interpret(map);
System.out.println("exp2 match result [true]:" + b);
// 测试 contains
map= new HashMap<>();
map.put("a", 1);
map.put("b", "1zhanf21jkd21");
Expression exp3 = ExpressionParser.fromString("(a in (6,2,3) and b contains '214j') OR (a = 3 OR b != '1')");
b = exp3.interpret(map);
System.out.println("exp3 match result [true]:" + b);
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。