@Nullable private <T> T getOptionalNestedField(final JSONObject s, final String fieldId, final JsonObjectParser<T> jsonParser) throws JSONException { final JSONObject fieldJson = JsonParseUtil.getNestedOptionalObject(s, FIELDS, fieldId); // for fields like assignee (when unassigned) value attribute may be missing completely if (fieldJson != null) { return jsonParser.parse(fieldJson); } return null; }
@Nullable private <T> T getOptionalNestedField(final JSONObject s, final String fieldId, final JsonObjectParser<T> jsonParser) throws JSONException { final JSONObject fieldJson = JsonParseUtil.getNestedOptionalObject(s, FIELDS, fieldId); // for fields like assignee (when unassigned) value attribute may be missing completely if (fieldJson != null) { return jsonParser.parse(fieldJson); } return null; }
@Nullable private <T> T getOptionalField(boolean shouldUseNestedValue, JSONObject s, final String fieldId, JsonObjectParser<T> jsonParser) throws JSONException { final JSONObject fieldJson = JsonParseUtil.getNestedOptionalObject(s, FIELDS, fieldId); // for fields like assignee (when unassigned) value attribute may be missing completely if (fieldJson != null) { if (shouldUseNestedValue) { final JSONObject valueJsonObject = fieldJson.optJSONObject(VALUE_ATTR); if (valueJsonObject != null) { return jsonParser.parse(valueJsonObject); } } else { return jsonParser.parse(fieldJson); } } return null; }
@Nullable private <T> T getOptionalField(boolean shouldUseNestedValue, JSONObject s, final String fieldId, JsonObjectParser<T> jsonParser) throws JSONException { final JSONObject fieldJson = JsonParseUtil.getNestedOptionalObject(s, FIELDS, fieldId); // for fields like assignee (when unassigned) value attribute may be missing completely if (fieldJson != null) { if (shouldUseNestedValue) { final JSONObject valueJsonObject = fieldJson.optJSONObject(VALUE_ATTR); if (valueJsonObject != null) { return jsonParser.parse(valueJsonObject); } } else { return jsonParser.parse(fieldJson); } } return null; }
@Nullable private <T> Collection<T> parseOptionalArray(boolean shouldUseNestedValueJson, JSONObject json, JsonWeakParser<T> jsonParser, String... path) throws JSONException { if (shouldUseNestedValueJson) { final JSONObject js = JsonParseUtil.getNestedOptionalObject(json, path); if (js == null) { return null; } return parseArray(js, jsonParser, VALUE_ATTR); } else { final JSONArray jsonArray = JsonParseUtil.getNestedOptionalArray(json, path); if (jsonArray == null) { return null; } final Collection<T> res = new ArrayList<T>(jsonArray.length()); for (int i = 0; i < jsonArray.length(); i++) { res.add(jsonParser.parse(jsonArray.get(i))); } return res; } }
@Nullable private <T> Collection<T> parseOptionalArray(boolean shouldUseNestedValueJson, JSONObject json, JsonWeakParser<T> jsonParser, String... path) throws JSONException { if (shouldUseNestedValueJson) { final JSONObject js = JsonParseUtil.getNestedOptionalObject(json, path); if (js == null) { return null; } return parseArray(js, jsonParser, VALUE_ATTR); } else { final JSONArray jsonArray = JsonParseUtil.getNestedOptionalArray(json, path); if (jsonArray == null) { return null; } final Collection<T> res = new ArrayList<T>(jsonArray.length()); for (int i = 0; i < jsonArray.length(); i++) { res.add(jsonParser.parse(jsonArray.get(i))); } return res; } }
if (JsonParseUtil.getNestedOptionalObject(s, FIELDS, WORKLOG_FIELD.id) != null) { worklogs = parseOptionalArray(shouldUseNestedValueAttribute, s, new JsonWeakParserForJsonObject<Worklog>(new WorklogJsonParserV5(JsonParseUtil.getSelfUri(s))),
if (JsonParseUtil.getNestedOptionalObject(s, FIELDS, WORKLOG_FIELD.id) != null) { worklogs = parseOptionalArray(shouldUseNestedValueAttribute, s, new JsonWeakParserForJsonObject<Worklog>(new WorklogJsonParserV5(selfUri)),
if (JsonParseUtil.getNestedOptionalObject(issueJson, FIELDS, WORKLOG_FIELD.id) != null) { worklogs = parseOptionalArray(issueJson, new JsonWeakParserForJsonObject<Worklog>(new WorklogJsonParserV5(selfUri)),
if (JsonParseUtil.getNestedOptionalObject(issueJson, FIELDS, WORKLOG_FIELD.id) != null) { worklogs = parseOptionalArray(issueJson, new JsonWeakParserForJsonObject<Worklog>(new WorklogJsonParserV5(selfUri)),