本文整理了Java中net.minidev.json.JSONObject.merge()
方法的一些代码示例,展示了JSONObject.merge()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSONObject.merge()
方法的具体详情如下:
包路径:net.minidev.json.JSONObject
类名称:JSONObject
方法名:merge
暂无
代码示例来源:origin: net.minidev/json-smart-action
@Override
public void pathEnd(String path) {
destTree.merge(destBranch);
}
代码示例来源:origin: net.minidev/json-smart
public void merge(Object o2) {
merge(this, o2);
}
代码示例来源:origin: netplex/json-smart-v2
@Override
public void pathEnd(String path) {
destTree.merge(destBranch);
}
代码示例来源:origin: netplex/json-smart-v2
public void merge(Object o2) {
merge(this, o2);
}
代码示例来源:origin: netplex/json-smart-v2
public void merge(Object o2) {
JSONObject.merge(this, o2);
}
代码示例来源:origin: net.minidev/json-smart
public void merge(Object o2) {
JSONObject.merge(this, o2);
}
代码示例来源:origin: net.minidev/json-smart
protected static JSONObject merge(JSONObject o1, Object o2) {
if (o2 == null)
return o1;
if (o2 instanceof JSONObject)
return merge(o1, (JSONObject) o2);
throw new RuntimeException("JSON megre can not merge JSONObject with " + o2.getClass());
}
代码示例来源:origin: netplex/json-smart-v2
protected static JSONObject merge(JSONObject o1, Object o2) {
if (o2 == null)
return o1;
if (o2 instanceof JSONObject)
return merge(o1, (JSONObject) o2);
throw new RuntimeException("JSON megre can not merge JSONObject with " + o2.getClass());
}
代码示例来源:origin: netplex/json-smart-v2
protected static JSONArray merge(JSONArray o1, Object o2) {
if (o2 == null)
return o1;
if (o1 instanceof JSONArray)
return merge(o1, (JSONArray) o2);
o1.add(o2);
return o1;
}
代码示例来源:origin: net.minidev/json-smart
protected static JSONArray merge(JSONArray o1, Object o2) {
if (o2 == null)
return o1;
if (o1 instanceof JSONArray)
return merge(o1, (JSONArray) o2);
o1.add(o2);
return o1;
}
代码示例来源:origin: net.minidev/json-smart
private static JSONObject merge(JSONObject o1, JSONObject o2) {
if (o2 == null)
return o1;
for (String key : o1.keySet()) {
Object value1 = o1.get(key);
Object value2 = o2.get(key);
if (value2 == null)
continue;
if (value1 instanceof JSONArray) {
o1.put(key, merge((JSONArray) value1, value2));
continue;
}
if (value1 instanceof JSONObject) {
o1.put(key, merge((JSONObject) value1, value2));
continue;
}
if (value1.equals(value2))
continue;
if (value1.getClass() .equals(value2.getClass()))
throw new RuntimeException("JSON merge can not merge two " + value1.getClass().getName() + " Object together");
throw new RuntimeException("JSON merge can not merge " + value1.getClass().getName() + " with " + value2.getClass().getName());
}
for (String key : o2.keySet()) {
if (o1.containsKey(key))
continue;
o1.put(key, o2.get(key));
}
return o1;
}
代码示例来源:origin: netplex/json-smart-v2
private static JSONObject merge(JSONObject o1, JSONObject o2) {
if (o2 == null)
return o1;
for (String key : o1.keySet()) {
Object value1 = o1.get(key);
Object value2 = o2.get(key);
if (value2 == null)
continue;
if (value1 instanceof JSONArray) {
o1.put(key, merge((JSONArray) value1, value2));
continue;
}
if (value1 instanceof JSONObject) {
o1.put(key, merge((JSONObject) value1, value2));
continue;
}
if (value1.equals(value2))
continue;
if (value1.getClass() .equals(value2.getClass()))
throw new RuntimeException("JSON merge can not merge two " + value1.getClass().getName() + " Object together");
throw new RuntimeException("JSON merge can not merge " + value1.getClass().getName() + " with " + value2.getClass().getName());
}
for (String key : o2.keySet()) {
if (o1.containsKey(key))
continue;
o1.put(key, o2.get(key));
}
return o1;
}
内容来源于网络,如有侵权,请联系作者删除!