net.sf.json.JSONObject.discard()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(1.8k)|赞(0)|评价(0)|浏览(258)

本文整理了Java中net.sf.json.JSONObject.discard()方法的一些代码示例,展示了JSONObject.discard()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSONObject.discard()方法的具体详情如下:
包路径:net.sf.json.JSONObject
类名称:JSONObject
方法名:discard

JSONObject.discard介绍

暂无

代码示例

代码示例来源:origin: gooddata/GoodData-CL

public JSONObject discard(String key) {
  return jsonObject.discard(key);
}

代码示例来源:origin: org.geoserver.community/gs-wps-remote

serviceResultJSON.discard((String) keyToDiscard);

代码示例来源:origin: gooddata/GoodData-CL

throw new GdcRestApiException("The JSON object doesn't contain the meta tag object=" + jsonObject.toString());
m.discard("author");
m.discard("contributor");
m.discard("created");
m.discard("updated");
  c.discard("results");
  c.discard("entries");

代码示例来源:origin: gooddata/GoodData-CL

/**
 * Strips all keys that should not be sent to the create method
 */
public void stripKeysForCreate() {
  Iterator keys = jsonObject.keys();
  if (keys.hasNext()) {
    String rootKey = (String) keys.next();
    JSONObject r = jsonObject.getJSONObject(rootKey);
    if (r == null || r.isNullObject() || r.isEmpty()) {
      l.debug("The JSON object doesn't contain the root object=" + jsonObject.toString());
      throw new GdcRestApiException("The JSON object doesn't contain the root object=" + jsonObject.toString());
    }
    JSONObject m = r.getJSONObject("meta");
    if (m == null || m.isNullObject() || m.isEmpty()) {
      l.debug("The JSON object doesn't contain the meta tag object=" + jsonObject.toString());
      throw new GdcRestApiException("The JSON object doesn't contain the meta tag object=" + jsonObject.toString());
    }
    m.discard("uri");
  } else {
    l.debug("The JSON object doesn't contain any root object=" + jsonObject.toString());
    throw new GdcRestApiException("The JSON object doesn't contain any root object=" + jsonObject.toString());
  }
}

相关文章

微信公众号

最新文章

更多