谷歌引擎表达式aviator简单demo
String str = "{'A':'北京市','urlTimestamp':'1562747858.662','urlTime':'[10/Jul/2019:16:37:38 +0800]','deviceId':'58553C9A0974CFDB25','province':'北京','appKey':'432b6d2931efd34037fe282d','phoneType':'1','fieldUrl':'/publicLog/appVirus','shortAppKey':'AA'}";
String str2 = "{'A':'false','B':'true'}";
String str3 = "{'A':'true','B':'true'}";
Map<String, Object> exMap = JSON.parseObject(str3, Map.class);
for (String obj : exMap.keySet()) {
String key = obj;
Object value = new Boolean(exMap.get(obj).toString());
System.out.println("key为:" + obj + "值为:" + exMap.get(obj));
exMap.put(key, value);
}
String relationship = "A&&B";
Expression expression = AviatorEvaluator.compile(relationship);
Boolean rs = (Boolean) expression.execute(exMap);
System.out.println("rs = " + rs);
还没有评论,来说两句吧...