com.googlecode.fascinator.common.JsonObject.containsKey()方法的使用及代码示例

x33g5p2x  于2022-01-22 转载在 其他  
字(3.2k)|赞(0)|评价(0)|浏览(111)

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

JsonObject.containsKey介绍

暂无

代码示例

代码示例来源:origin: com.googlecode.the-fascinator/fascinator-common

boolean hasIncludedDir = getJsonObject().containsKey(INCLUDE_DIR_KEY);
boolean systemHasIncludedDir = systemConfig.getJsonObject()
    .containsKey(INCLUDE_DIR_KEY);
if (hasIncludedDir) {
  log.trace("Loading main included dir...");

代码示例来源:origin: com.googlecode.redbox-mint/plugin-transaction-curation-redbox

/**
 * Get a child JSON Array from an incoming JSON object. If the child does
 * not exist it will be created.
 *
 * @param object The incoming object we are to look inside
 * @param key The child node we are looking for
 * @return JSONArray The child we found or created
 * @throws IOException if there is a type mismatch on existing data
 */
private static JSONArray getArray(JsonObject object, String key)
    throws IOException {
  // Get the existing one
  if (object.containsKey(key)) {
    Object existing = object.get(key);
    if (!(existing instanceof JSONArray)) {
      throw new IOException("Invalid field structure, '" + key +
          "' expected to be an array, but incompatible "
          + "data type already present.");
    }
    return (JSONArray) existing;
  // Or add a new one
  } else {
    JSONArray newObject = new JSONArray();
    object.put(key, newObject);
    return newObject;
  }
}

代码示例来源:origin: com.googlecode.redbox-mint/plugin-transaction-curation-redbox

/**
 * Get a child JSON Object from an incoming JSON object. If the child does
 * not exist it will be created.
 *
 * @param object The incoming object we are to look inside
 * @param key The child node we are looking for
 * @return JsonObject The child we found or created
 * @throws IOException if there is a type mismatch on existing data
 */
private static JsonObject getObject(JsonObject object, String key)
    throws IOException {
  // Get the existing one
  if (object.containsKey(key)) {
    Object existing = object.get(key);
    if (!(existing instanceof JsonObject)) {
      throw new IOException("Invalid field structure, '" + key +
          "' expected to be an object, but incompatible "
          + "data type already present.");
    }
    return (JsonObject) existing;
  // Or add a new one
  } else {
    JsonObject newObject = new JsonObject();
    object.put(key, newObject);
    return newObject;
  }
}

代码示例来源:origin: com.googlecode.redbox-mint/plugin-transaction-curation-redbox

if (newRelation.containsKey("oid")) {
  for (Object relation : relations) {
    JsonObject json = (JsonObject) relation;
  JsonObject json = (JsonObject) relation;
  if (json.containsKey("identifier")) {
    String knownId = (String) json.get("identifier");
    String knownField = (String) json.get("field");

代码示例来源:origin: com.googlecode.the-fascinator/fascinator-common

/**
 * Get a writable JsonObject for the parent of the indicated ID.
 *
 * This method will ensure that the identified node exists and that the
 * object returned is writable and has the ID'd node as a child.
 *
 * @param id : The node ID to find the parent of.
 * @return JsonObject : A writable JsonObject
 */
private JsonObject getWritableParent(String id) {
  // Find this node
  ManifestNode node = getNode(id);
  if (node == null) {
    return null;
  }
  // Find the parent
  String pId = node.getParentKey();
  JsonObject target = getWritableNode(pId);
  // Confirm our data
  if (target == null || !target.containsKey(id)) {
    return null;
  }
  return target;
}

相关文章