private ConfigurationMetadataSource parseSource(JSONObject json) throws Exception { ConfigurationMetadataSource source = new ConfigurationMetadataSource(); source.setGroupId(json.getString("name")); source.setType(json.optString("type", null)); String description = json.optString("description", null); source.setDescription(description); source.setShortDescription(this.sentenceExtractor.getFirstSentence(description)); source.setSourceType(json.optString("sourceType", null)); source.setSourceMethod(json.optString("sourceMethod", null)); return source; }
private Deprecation parseDeprecation(JSONObject object) throws Exception { if (object.has("deprecation")) { JSONObject deprecationJsonObject = object.getJSONObject("deprecation"); Deprecation deprecation = new Deprecation(); deprecation.setLevel(parseDeprecationLevel( deprecationJsonObject.optString("level", null))); String reason = deprecationJsonObject.optString("reason", null); deprecation.setReason(reason); deprecation.setShortReason(this.sentenceExtractor.getFirstSentence(reason)); deprecation .setReplacement(deprecationJsonObject.optString("replacement", null)); return deprecation; } return object.optBoolean("deprecated") ? new Deprecation() : null; }
valueHint.setDescription(description); valueHint.setShortDescription( this.sentenceExtractor.getFirstSentence(description)); hint.getValueHints().add(valueHint);
private ConfigurationMetadataItem parseItem(JSONObject json) throws Exception { ConfigurationMetadataItem item = new ConfigurationMetadataItem(); item.setId(json.getString("name")); item.setType(json.optString("type", null)); String description = json.optString("description", null); item.setDescription(description); item.setShortDescription(this.sentenceExtractor.getFirstSentence(description)); item.setDefaultValue(readItemValue(json.opt("defaultValue"))); item.setDeprecation(parseDeprecation(json)); item.setSourceType(json.optString("sourceType", null)); item.setSourceMethod(json.optString("sourceMethod", null)); return item; }