@Override public Project parse(JSONObject json) throws JSONException { URI self = JsonParseUtil.getSelfUri(json); final Iterable<String> expandos = parseExpandos(json); final BasicUser lead = JsonParseUtil.parseBasicUser(json.getJSONObject("lead")); final String key = json.getString("key"); final Long id = JsonParseUtil.getOptionalLong(json, "id"); final String name = JsonParseUtil.getOptionalString(json, "name"); final String urlStr = JsonParseUtil.getOptionalString(json, "url"); URI uri; try { uri = urlStr == null || "".equals(urlStr) ? null : new URI(urlStr); } catch (URISyntaxException e) { uri = null; } String description = JsonParseUtil.getOptionalString(json, "description"); if ("".equals(description)) { description = null; } final Collection<Version> versions = JsonParseUtil.parseJsonArray(json.getJSONArray("versions"), versionJsonParser); final Collection<BasicComponent> components = JsonParseUtil.parseJsonArray(json .getJSONArray("components"), componentJsonParser); final JSONArray issueTypesArray = json.optJSONArray("issueTypes"); final OptionalIterable<IssueType> issueTypes = JsonParseUtil.parseOptionalJsonArray(issueTypesArray, issueTypeJsonParser); final Collection<BasicProjectRole> projectRoles = basicProjectRoleJsonParser.parse(JsonParseUtil .getOptionalJsonObject(json, "roles")); return new Project(expandos, self, key, id, name, description, lead, uri, versions, components, issueTypes, projectRoles); }
@Override public Project parse(JSONObject json) throws JSONException { URI self = JsonParseUtil.getSelfUri(json); final Iterable<String> expandos = parseExpandos(json); final BasicUser lead = JsonParseUtil.parseBasicUser(json.getJSONObject("lead")); final String key = json.getString("key"); final Long id = JsonParseUtil.getOptionalLong(json, "id"); final String name = JsonParseUtil.getOptionalString(json, "name"); final String urlStr = JsonParseUtil.getOptionalString(json, "url"); URI uri; try { uri = urlStr == null || "".equals(urlStr) ? null : new URI(urlStr); } catch (URISyntaxException e) { uri = null; } String description = JsonParseUtil.getOptionalString(json, "description"); if ("".equals(description)) { description = null; } final Collection<Version> versions = JsonParseUtil.parseJsonArray(json.getJSONArray("versions"), versionJsonParser); final Collection<BasicComponent> components = JsonParseUtil.parseJsonArray(json .getJSONArray("components"), componentJsonParser); final JSONArray issueTypesArray = json.optJSONArray("issueTypes"); final OptionalIterable<IssueType> issueTypes = JsonParseUtil.parseOptionalJsonArray(issueTypesArray, issueTypeJsonParser); final Collection<BasicProjectRole> projectRoles = basicProjectRoleJsonParser.parse(JsonParseUtil .getOptionalJsonObject(json, "roles")); return new Project(expandos, self, key, id, name, description, lead, uri, versions, components, issueTypes, projectRoles); }