/** * Parse the JSON returned from splunkd describing this data model. * * This method writes the results into fields of this object. * * @param input a String containing JSON. */ private void parseDescription(String input) { objects = new HashMap<String, DataModelObject>(); JsonElement rootElement = jsonParser.parse(input); for (Entry<String, JsonElement> entry : rootElement.getAsJsonObject().entrySet()) { if (entry.getKey().equals(MODEL_NAME_LABEL)) { content.put(MODEL_NAME_LABEL, entry.getValue().getAsString()); } else if (entry.getKey().equals(DISPLAY_NAME_LABEL)) { content.put(DISPLAY_NAME_LABEL, entry.getValue().getAsString()); } else if (entry.getKey().equals(DESCRIPTION_LABEL)) { description = entry.getValue().getAsString(); } else if (entry.getKey().equals("objects")) { JsonArray objectArray = entry.getValue().getAsJsonArray(); for (JsonElement object : objectArray) { DataModelObject dmo = DataModelObject.parse(this, object); objects.put(dmo.getName(), dmo); } } else { // Allow new keys without complaining } } }