MCPcopy Index your code
hub / github.com/VolmitSoftware/Adapt / append

Method append

src/main/java/com/volmit/adapt/util/JSONObject.java:731–742  ·  view source on GitHub ↗

Append values to the array under a key. If the key does not exist in the JSONObject, then the key is put in the JSONObject with its value being a JSONArray containing the value parameter. If the key was already associated with a JSONArray, then the value parameter is appended to it. @param key A

(String key, Object value)

Source from the content-addressed store, hash-verified

729 * the key is not a JSONArray.
730 */
731 public JSONObject append(String key, Object value) throws JSONException {
732 testValidity(value);
733 Object object = this.opt(key);
734 if (object == null) {
735 this.put(key, new JSONArray().put(value));
736 } else if (object instanceof JSONArray) {
737 this.put(key, ((JSONArray) object).put(value));
738 } else {
739 throw new JSONException("JSONObject[" + key + "] is not a JSONArray.");
740 }
741 return this;
742 }
743
744 /**
745 * Get the value object associated with a key.

Callers 15

executeMethod · 0.45
executeMethod · 0.45
notifyXPMethod · 0.45
generateColorTableMethod · 0.45
toStringMethod · 0.45
_compressMethod · 0.45
_decompressMethod · 0.45
nextStringMethod · 0.45
nextToMethod · 0.45
nextValueMethod · 0.45
nextTokenMethod · 0.45
toStringMethod · 0.45

Calls 3

testValidityMethod · 0.95
optMethod · 0.95
putMethod · 0.95

Tested by

no test coverage detected