/** * Append a boolean value. This increases the array's length by one. * * @param value A boolean value. * @return this. */ public JSONArray put(final boolean value) { put(value ? Boolean.TRUE : Boolean.FALSE); return this; }
/** * Put or replace a boolean value in the JSONArray. If the index is greater * than the length of the JSONArray, then null elements will be added as * necessary to pad it out. * @param index The subscript. * @param value A boolean value. * @return this. * @throws JSONException If the index is negative. */ public JSONArray put(final int index, final boolean value) throws JSONException { put(index, value ? Boolean.TRUE : Boolean.FALSE); return this; }
/** * Put or replace a boolean value in the JSONArray. If the index is greater * than the length of the JSONArray, then null elements will be added as * necessary to pad it out. * @param index The subscript. * @param value A boolean value. * @return this. * @throws JSONException If the index is negative. */ public JSONArray put(final int index, final boolean value) throws JSONException { put(index, value ? Boolean.TRUE : Boolean.FALSE); return this; }
/** * Append an int value. This increases the array's length by one. * * @param value An int value. * @return this. */ public JSONArray put(final int value) { put(new Integer(value)); return this; }
/** * Append an long value. This increases the array's length by one. * * @param value A long value. * @return this. */ public JSONArray put(final long value) { put(Long.valueOf(value)); return this; }
/** * Put or replace an int value. If the index is greater than the length of * the JSONArray, then null elements will be added as necessary to pad * it out. * @param index The subscript. * @param value An int value. * @return this. * @throws JSONException If the index is negative. */ public JSONArray put(final int index, final int value) throws JSONException { put(index, new Integer(value)); return this; }
/** * Put or replace a long value. If the index is greater than the length of * the JSONArray, then null elements will be added as necessary to pad * it out. * @param index The subscript. * @param value A long value. * @return this. * @throws JSONException If the index is negative. */ public JSONArray put(final int index, final long value) throws JSONException { put(index, Long.valueOf(value)); return this; }
/** * Put or replace an int value. If the index is greater than the length of * the JSONArray, then null elements will be added as necessary to pad * it out. * @param index The subscript. * @param value An int value. * @return this. * @throws JSONException If the index is negative. */ public JSONArray put(final int index, final int value) throws JSONException { put(index, Integer.valueOf(value)); return this; }
/** * Put or replace a long value. If the index is greater than the length of * the JSONArray, then null elements will be added as necessary to pad * it out. * @param index The subscript. * @param value A long value. * @return this. * @throws JSONException If the index is negative. */ public JSONArray put(final int index, final long value) throws JSONException { put(index, new Long(value)); return this; }
/** * Put a value in the JSONArray, where the value will be a * JSONArray which is produced from a Collection. * @param value A Collection value. * @return this. */ public JSONArray put(final Collection value) { put(new JSONArray(value)); return this; }
/** * Put a value in the JSONArray, where the value will be a * JSONObject which is produced from a Map. * @param value A Map value. * @return this. */ public JSONArray put(final Map value) { put(new JSONObject(value)); return this; }
/** * Put a value in the JSONArray, where the value will be a * JSONObject which is produced from a Map. * @param value A Map value. * @return this. */ public JSONArray put(final Map value) { put(new JSONObject(value)); return this; }
/** * Put a value in the JSONArray, where the value will be a * JSONArray which is produced from a Collection. * @param value A Collection value. * @return this. */ public JSONArray put(final Collection value) { put(new JSONArray(value)); return this; }
/** * Put a value in the JSONArray, where the value will be a * JSONObject which is produced from a Map. * @param index The subscript. * @param value The Map value. * @return this. * @throws JSONException If the index is negative or if the the value is * an invalid number. */ public JSONArray put(final int index, final Map value) throws JSONException { put(index, new JSONObject(value)); return this; }
/** * Append a double value. This increases the array's length by one. * * @param value A double value. * @throws JSONException if the value is not finite. * @return this. */ public JSONArray put(final double value) throws JSONException { Double d = new Double(value); JSONObject.testValidity(d); put(d); return this; }
/** * Put a value in the JSONArray, where the value will be a * JSONArray which is produced from a Collection. * @param index The subscript. * @param value A Collection value. * @return this. * @throws JSONException If the index is negative or if the value is * not finite. */ public JSONArray put(final int index, final Collection value) throws JSONException { put(index, new JSONArray(value)); return this; }
/** * Append a double value. This increases the array's length by one. * * @param value A double value. * @throws JSONException if the value is not finite. * @return this. */ public JSONArray put(final double value) throws JSONException { Double d = new Double(value); JSONObject.testValidity(d); put(d); return this; }
private static JSONArray toJSONMsgArray(final Map<String, Object>[] messages) { JSONArray array = new JSONArray(); for (Map<String, Object> message : messages) { array.put(new JSONObject(message)); } return array; }
static String toJSON(final Map<String, Object>[] messages) { JSONArray array = new JSONArray(); for (Map<String, Object> message : messages) { array.put(new JSONObject(message)); } return array.toString(); }
@Override public void describeProducersInfo(JSONArray array) throws Exception { Map<SimpleString, Pair<UUID, AtomicLong>> targetCopy = cloneTargetAddresses(); for (Map.Entry<SimpleString, Pair<UUID, AtomicLong>> entry : targetCopy.entrySet()) { JSONObject producerInfo = new JSONObject(); producerInfo.put("connectionID", this.getConnectionID().toString()); producerInfo.put("sessionID", this.getName()); producerInfo.put("destination", entry.getKey().toString()); producerInfo.put("lastUUIDSent", entry.getValue().getA()); producerInfo.put("msgSent", entry.getValue().getB().longValue()); array.put(producerInfo); } }