本文整理了Java中com.alibaba.fastjson.JSONObject.getOrDefault()
方法的一些代码示例,展示了JSONObject.getOrDefault()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSONObject.getOrDefault()
方法的具体详情如下:
包路径:com.alibaba.fastjson.JSONObject
类名称:JSONObject
方法名:getOrDefault
暂无
代码示例来源:origin: hs-web/hsweb-framework
protected Set<Correlation> buildCorrelations(String correlations) {
if (StringUtils.isEmpty(correlations)) {
return new LinkedHashSet<>();
}
JSONArray correlationsConfig = JSON.parseArray(correlations);
Set<Correlation> correlations1 = new LinkedHashSet<>();
for (int i = 0; i < correlationsConfig.size(); i++) {
JSONObject single = correlationsConfig.getJSONObject(i);
String target = single.getString("target");
String alias = single.getString("alias");
String condition = single.getString("condition");
Objects.requireNonNull(target);
Objects.requireNonNull(condition);
Correlation correlation = new Correlation(target, alias, condition);
correlation.setJoin(Correlation.JOIN.valueOf(String.valueOf(single.getOrDefault("join", "LEFT")).toUpperCase()));
JSONObject properties = single.getJSONObject("properties");
if (properties != null) {
properties.forEach(correlation::setProperty);
}
correlations1.add(correlation);
}
return correlations1;
}
代码示例来源:origin: xixifeng/fastquery
public static boolean getDebug() {
return (boolean) getJsonObject().getOrDefault(DEBUG, false);
}
代码示例来源:origin: org.hswebframework.web/hsweb-system-dynamic-form-local
protected Set<Correlation> buildCorrelations(String correlations) {
if (StringUtils.isEmpty(correlations)) {
return new LinkedHashSet<>();
}
JSONArray correlationsConfig = JSON.parseArray(correlations);
Set<Correlation> correlations1 = new LinkedHashSet<>();
for (int i = 0; i < correlationsConfig.size(); i++) {
JSONObject single = correlationsConfig.getJSONObject(i);
String target = single.getString("target");
String alias = single.getString("alias");
String condition = single.getString("condition");
Objects.requireNonNull(target);
Objects.requireNonNull(condition);
Correlation correlation = new Correlation(target, alias, condition);
correlation.setJoin(Correlation.JOIN.valueOf(String.valueOf(single.getOrDefault("join", "LEFT")).toUpperCase()));
JSONObject properties = single.getJSONObject("properties");
if (properties != null) {
properties.forEach(correlation::setProperty);
}
correlations1.add(correlation);
}
return correlations1;
}
代码示例来源:origin: info.xiancloud/xian-qclouddocker
throw new IllegalArgumentException("入参" + prefix + "healthCheck." + j + ".type" + "不允许为空");
params.put(prefix + "healthCheck." + j + ".type", healthChecks.getJSONObject(j).getString("type"));
params.put(prefix + "healthCheck." + j + ".healthNum", healthChecks.getJSONObject(j).getOrDefault("healthNum", 1) + "");
params.put(prefix + "healthCheck." + j + ".unhealthNum", healthChecks.getJSONObject(j).getOrDefault("unhealthNum", 3) + "");
params.put(prefix + "healthCheck." + j + ".intervalTime", healthChecks.getJSONObject(j).getOrDefault("intervalTime", 3) + "");
params.put(prefix + "healthCheck." + j + ".timeOut", healthChecks.getJSONObject(j).getOrDefault("timeOut", 2) + "");
params.put(prefix + "healthCheck." + j + ".delayTime", healthChecks.getJSONObject(j).getOrDefault("delayTime", 0) + "");
if (healthChecks.getJSONObject(j).getString("checkMethod") == null)
throw new IllegalArgumentException("入参" + prefix + "healthCheck." + j + ".checkMethod" + "不允许为空");
代码示例来源:origin: xiancloud/xian
_dashboard.put("id", dashboard.getJSONObject("dashboard").getOrDefault("id", null));
_dashboard.put("title", dashboard.getJSONObject("dashboard").getString("title"));
_dashboard.put("tags", dashboard.getJSONObject("dashboard").getJSONArray("tags"));
内容来源于网络,如有侵权,请联系作者删除!