org.codehaus.jettison.json.JSONObject.getBoolean()方法的使用及代码示例

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

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

JSONObject.getBoolean介绍

[英]Get the boolean value associated with a key.
[中]获取与键关联的布尔值。

代码示例

代码示例来源:origin: eBay/parallec

hasMore = jsonObjectNext.getBoolean(KEY_HAS_MORE);
if (jsonObjectNext.has(KEY_NEXT_PARENT)
    && jsonObjectNext.getJSONObject(KEY_NEXT_PARENT)

代码示例来源:origin: ORCID/ORCID-Source

public static Boolean extractBoolean(JSONObject record, String key) {
  //this should not happen
  if (record.isNull(key)) {
    return null;
  }
  try {
    return record.getBoolean(key);
  } catch (JSONException e) {
    throw new RuntimeException("Error extracting boolean from json", e);
  }
}

代码示例来源:origin: com.atlassian.jira/jira-rest-java-client-core

@SuppressWarnings("unused")
public static boolean getNestedBoolean(JSONObject json, final String... path) throws JSONException {
  for (int i = 0; i < path.length - 1; i++) {
    String s = path[i];
    json = json.getJSONObject(s);
  }
  return json.getBoolean(path[path.length - 1]);
}

代码示例来源:origin: com.atlassian.jira/jira-rest-java-client-p3

@SuppressWarnings("unused")
public static boolean getNestedBoolean(JSONObject json, String... path) throws JSONException {
  for (int i = 0; i < path.length - 1; i++) {
    String s = path[i];
    json = json.getJSONObject(s);
  }
  return json.getBoolean(path[path.length - 1]);
}

代码示例来源:origin: opensourceBIM/BIMserver

sServiceDescriptor.setReadRevision(rights.has("readRevision") && rights.getBoolean("readRevision"));
sServiceDescriptor.setReadExtendedData(rights.has("readExtendedData") ? rights.getString("readExtendedData") : null);
sServiceDescriptor.setWriteRevision(rights.has("writeRevision") && rights.getBoolean("writeRevision"));
sServiceDescriptor.setWriteExtendedData(rights.has("writeExtendedData") ? rights.getString("writeExtendedData") : null);
sServiceDescriptors.add(sServiceDescriptor);

代码示例来源:origin: org.openengsb.wrapped/jira-rest-java-client-core

@Override
public Field parse(final JSONObject jsonObject) throws JSONException {
  final String id = jsonObject.getString("id");
  final String name = jsonObject.getString("name");
  final Boolean orderable = jsonObject.getBoolean("orderable");
  final Boolean navigable = jsonObject.getBoolean("navigable");
  final Boolean searchable = jsonObject.getBoolean("searchable");
  final FieldType custom = jsonObject.getBoolean("custom") ? FieldType.CUSTOM : FieldType.JIRA;
  final FieldSchema schema = jsonObject.has("schema") ? schemaJsonParser.parse(jsonObject.getJSONObject("schema")) : null;
  return new Field(id, name, custom, orderable, navigable, searchable, schema);
}

代码示例来源:origin: apache/incubator-atlas

public static AttributeDefinition fromJson(String jsonStr) throws JSONException {
    JSONObject json = new JSONObject(jsonStr);
    String reverseAttr = null;
    if (json.has("reverseAttributeName")) {
      reverseAttr = json.getString("reverseAttributeName");
    }
    return new AttributeDefinition(json.getString("name"), json.getString("dataType"),
        Multiplicity.fromJson(json.getString("multiplicity")), json.getBoolean("isComposite"),
        json.getBoolean("isUnique"), json.getBoolean("isIndexable"), reverseAttr);
  }
}

代码示例来源:origin: com.atlassian.jira/jira-rest-java-client-p3

@Override
  public Transition.Field parse(JSONObject json) throws JSONException {
    final String name = json.getString("id");
    final boolean isRequired = json.getBoolean("required");
    final String type = json.getString("type");
    return new Transition.Field(name, isRequired, type);
  }
}

代码示例来源:origin: com.atlassian.jira/jira-rest-java-client-core

public Transition.Field parse(JSONObject json, final String id) throws JSONException {
    final boolean isRequired = json.getBoolean("required");
    final String type = json.getJSONObject("schema").getString("type");
    return new Transition.Field(id, isRequired, type);
  }
}

代码示例来源:origin: com.atlassian.jira/jira-rest-java-client-core

private static BasicWatchers parseValueImpl(JSONObject json) throws JSONException {
  final URI self = JsonParseUtil.getSelfUri(json);
  final boolean isWatching = json.getBoolean("isWatching");
  final int numWatchers = json.getInt("watchCount");
  return new BasicWatchers(self, isWatching, numWatchers);
}

代码示例来源:origin: com.atlassian.jira/jira-rest-java-client

private static BasicWatchers parseValueImpl(JSONObject json) throws JSONException {
  final URI self = JsonParseUtil.getSelfUri(json);
  final boolean isWatching = json.getBoolean("isWatching");
  final int numWatchers = json.getInt("watchCount");
  return new BasicWatchers(self, isWatching, numWatchers);
}

代码示例来源:origin: org.openengsb.wrapped/jira-rest-java-client-core

@Override
  public BasicVotes parse(JSONObject json) throws JSONException {
    final URI self = JsonParseUtil.getSelfUri(json);
    final int voteCount = json.getInt("votes");
    final boolean hasVoted = json.getBoolean("hasVoted");
    return new BasicVotes(self, voteCount, hasVoted);
  }
}

代码示例来源:origin: com.atlassian.jira/jira-rest-java-client-p3

public Transition.Field parse(JSONObject json, final String id) throws JSONException {
    final boolean isRequired = json.getBoolean("required");
    final String type = json.getJSONObject("schema").getString("type");
    return new Transition.Field(id, isRequired, type);
  }
}

代码示例来源:origin: com.atlassian.jira/jira-rest-java-client-p3

@Override
  public BasicVotes parse(JSONObject json) throws JSONException {
    final URI self = JsonParseUtil.getSelfUri(json);
    final int voteCount = json.getInt("votes");
    final boolean hasVoted = json.getBoolean("hasVoted");
    return new BasicVotes(self, voteCount, hasVoted);
  }
}

代码示例来源:origin: com.atlassian.jira/jira-rest-java-client

@Override
public Version parse(JSONObject json) throws JSONException {
  final URI self = JsonParseUtil.getSelfUri(json);
  final Long id = JsonParseUtil.getOptionalLong(json, "id");
  final String name = json.getString("name");
  final String description = JsonParseUtil.getOptionalString(json, "description");
  final boolean isArchived = json.getBoolean("archived");
  final boolean isReleased = json.getBoolean("released");
  final String releaseDateStr = JsonParseUtil.getOptionalString(json, "releaseDate");
  final DateTime releaseDate = parseReleaseDate(releaseDateStr);
  return new Version(self, id, name, description, isArchived, isReleased, releaseDate);
}

代码示例来源:origin: org.openengsb.wrapped/jira-rest-java-client-core

@Override
  public Permission parse(final JSONObject json) throws JSONException {
    final Integer id = json.getInt("id");
    final String key = json.getString("key");
    final String name = json.getString("name");
    final String description = json.getString("description");
    final boolean havePermission = json.getBoolean("havePermission");
    return new Permission(id, key, name, description, havePermission);
  }
}

代码示例来源:origin: com.atlassian.jira/jira-rest-java-client

private CimFieldInfo parseIssueFieldInfo(JSONObject json, String id) throws JSONException {
  final boolean required = json.getBoolean("required");
  final String name = JsonParseUtil.getOptionalString(json, "name");
  final FieldSchema schema = fieldSchemaJsonParser.parse(json.getJSONObject("schema"));
  final Set<StandardOperation> operations = parseOperations(json.getJSONArray("operations"));
  final Iterable<Object> allowedValues = parseAllowedValues(json.optJSONArray("allowedValues"), schema);
  final URI autoCompleteUri = JsonParseUtil.parseOptionalURI(json, "autoCompleteUrl");
  return new CimFieldInfo(id, required, name, schema, operations, allowedValues, autoCompleteUri);
}

代码示例来源:origin: com.atlassian.jira/jira-rest-java-client-core

private CimFieldInfo parseIssueFieldInfo(JSONObject json, String id) throws JSONException {
  final boolean required = json.getBoolean("required");
  final String name = JsonParseUtil.getOptionalString(json, "name");
  final FieldSchema schema = fieldSchemaJsonParser.parse(json.getJSONObject("schema"));
  final Set<StandardOperation> operations = parseOperations(json.getJSONArray("operations"));
  final Iterable<Object> allowedValues = parseAllowedValues(json.optJSONArray("allowedValues"), schema);
  final URI autoCompleteUri = JsonParseUtil.parseOptionalURI(json, "autoCompleteUrl");
  return new CimFieldInfo(id, required, name, schema, operations, allowedValues, autoCompleteUri);
}

代码示例来源:origin: com.atlassian.jira/jira-rest-java-client-p3

private CimFieldInfo parseIssueFieldInfo(JSONObject json, String id) throws JSONException {
  final boolean required = json.getBoolean("required");
  final String name = JsonParseUtil.getOptionalString(json, "name");
  final FieldSchema schema = fieldSchemaJsonParser.parse(json.getJSONObject("schema"));
  final Set<StandardOperation> operations = parseOperations(json.getJSONArray("operations"));
  final Iterable<Object> allowedValues = parseAllowedValues(json.optJSONArray("allowedValues"), schema);
  final URI autoCompleteUri = JsonParseUtil.parseOptionalURI(json, "autoCompleteUrl");
  return new CimFieldInfo(id, required, name, schema, operations, allowedValues, autoCompleteUri);
}

代码示例来源:origin: org.openengsb.wrapped/jira-rest-java-client-core

private CimFieldInfo parseIssueFieldInfo(JSONObject json, String id) throws JSONException {
  final boolean required = json.getBoolean("required");
  final String name = JsonParseUtil.getOptionalString(json, "name");
  final FieldSchema schema = fieldSchemaJsonParser.parse(json.getJSONObject("schema"));
  final Set<StandardOperation> operations = parseOperations(json.getJSONArray("operations"));
  final Iterable<Object> allowedValues = parseAllowedValues(json.optJSONArray("allowedValues"), schema);
  final URI autoCompleteUri = JsonParseUtil.parseOptionalURI(json, "autoCompleteUrl");
  return new CimFieldInfo(id, required, name, schema, operations, allowedValues, autoCompleteUri);
}

相关文章