1
0
Fork 0
mirror of https://github.com/ethauvin/JSON-java.git synced 2025-06-17 07:50:52 -07:00

Update javadoc according to issue #356.

This commit is contained in:
John J. Aylward 2017-07-15 12:17:27 -04:00
parent 5024f2d210
commit 6f238a3698
2 changed files with 72 additions and 16 deletions

View file

@ -1230,7 +1230,7 @@ public class JSONArray implements Iterable<Object> {
* Queries and returns a value from this object using {@code jsonPointer}, or * Queries and returns a value from this object using {@code jsonPointer}, or
* returns null if the query fails due to a missing key. * returns null if the query fails due to a missing key.
* *
* @param The JSON pointer * @param jsonPointer The JSON pointer
* @return the queried value or {@code null} * @return the queried value or {@code null}
* @throws IllegalArgumentException if {@code jsonPointer} has invalid syntax * @throws IllegalArgumentException if {@code jsonPointer} has invalid syntax
*/ */
@ -1323,8 +1323,9 @@ public class JSONArray implements Iterable<Object> {
* whitespace is added. If it is not possible to produce a syntactically * whitespace is added. If it is not possible to produce a syntactically
* correct JSON text then null will be returned instead. This could occur if * correct JSON text then null will be returned instead. This could occur if
* the array contains an invalid number. * the array contains an invalid number.
* <p> * <p><b>
* Warning: This method assumes that the data structure is acyclical. * Warning: This method assumes that the data structure is acyclical.
* </b>
* *
* @return a printable, displayable, transmittable representation of the * @return a printable, displayable, transmittable representation of the
* array. * array.
@ -1339,9 +1340,24 @@ public class JSONArray implements Iterable<Object> {
} }
/** /**
* Make a pretty-printed JSON text of this JSONArray. Warning: This method * Make a pretty-printed JSON text of this JSONArray.
* assumes that the data structure is acyclical. *
* * <p>If <code>indentFactor > 0</code> and the {@link JSONArray} has only
* one element, then the array will be output on a single line:
* <pre>{@code [1]}</pre>
*
* <p>If an array has 2 or more elements, then it will be output across
* multiple lines: <pre>{@code
* [
* 1,
* "value 2",
* 3
* ]
* }</pre>
* <p><b>
* Warning: This method assumes that the data structure is acyclical.
* </b>
*
* @param indentFactor * @param indentFactor
* The number of spaces to add to each level of indentation. * The number of spaces to add to each level of indentation.
* @return a printable, displayable, transmittable representation of the * @return a printable, displayable, transmittable representation of the
@ -1360,8 +1376,9 @@ public class JSONArray implements Iterable<Object> {
/** /**
* Write the contents of the JSONArray as JSON text to a writer. For * Write the contents of the JSONArray as JSON text to a writer. For
* compactness, no whitespace is added. * compactness, no whitespace is added.
* <p> * <p><b>
* Warning: This method assumes that the data structure is acyclical. * Warning: This method assumes that the data structure is acyclical.
*</b>
* *
* @return The writer. * @return The writer.
* @throws JSONException * @throws JSONException
@ -1371,10 +1388,23 @@ public class JSONArray implements Iterable<Object> {
} }
/** /**
* Write the contents of the JSONArray as JSON text to a writer. For * Write the contents of the JSONArray as JSON text to a writer.
* compactness, no whitespace is added. *
* <p> * <p>If <code>indentFactor > 0</code> and the {@link JSONArray} has only
* one element, then the array will be output on a single line:
* <pre>{@code [1]}</pre>
*
* <p>If an array has 2 or more elements, then it will be output across
* multiple lines: <pre>{@code
* [
* 1,
* "value 2",
* 3
* ]
* }</pre>
* <p><b>
* Warning: This method assumes that the data structure is acyclical. * Warning: This method assumes that the data structure is acyclical.
* </b>
* *
* @param writer * @param writer
* Writes the serialized JSON * Writes the serialized JSON

View file

@ -1676,7 +1676,7 @@ public class JSONObject {
* Queries and returns a value from this object using {@code jsonPointer}, or * Queries and returns a value from this object using {@code jsonPointer}, or
* returns null if the query fails due to a missing key. * returns null if the query fails due to a missing key.
* *
* @param The JSON pointer * @param jsonPointer The JSON pointer
* @return the queried value or {@code null} * @return the queried value or {@code null}
* @throws IllegalArgumentException if {@code jsonPointer} has invalid syntax * @throws IllegalArgumentException if {@code jsonPointer} has invalid syntax
*/ */
@ -2002,9 +2002,10 @@ public class JSONObject {
* Make a JSON text of this JSONObject. For compactness, no whitespace is * Make a JSON text of this JSONObject. For compactness, no whitespace is
* added. If this would not result in a syntactically correct JSON text, * added. If this would not result in a syntactically correct JSON text,
* then null will be returned instead. * then null will be returned instead.
* <p> * <p><b>
* Warning: This method assumes that the data structure is acyclical. * Warning: This method assumes that the data structure is acyclical.
* * </b>
*
* @return a printable, displayable, portable, transmittable representation * @return a printable, displayable, portable, transmittable representation
* of the object, beginning with <code>{</code>&nbsp;<small>(left * of the object, beginning with <code>{</code>&nbsp;<small>(left
* brace)</small> and ending with <code>}</code>&nbsp;<small>(right * brace)</small> and ending with <code>}</code>&nbsp;<small>(right
@ -2021,8 +2022,20 @@ public class JSONObject {
/** /**
* Make a pretty-printed JSON text of this JSONObject. * Make a pretty-printed JSON text of this JSONObject.
* <p> *
* <p>If <code>indentFactor > 0</code> and the {@link JSONObject}
* has only one key, then the object will be output on a single line:
* <pre>{@code {"key": 1}}</pre>
*
* <p>If an object has 2 or more keys, then it will be output across
* multiple lines: <code><pre>{
* "key1": 1,
* "key2": "value 2",
* "key3": 3
* }</pre></code>
* <p><b>
* Warning: This method assumes that the data structure is acyclical. * Warning: This method assumes that the data structure is acyclical.
* </b>
* *
* @param indentFactor * @param indentFactor
* The number of spaces to add to each level of indentation. * The number of spaces to add to each level of indentation.
@ -2172,9 +2185,10 @@ public class JSONObject {
/** /**
* Write the contents of the JSONObject as JSON text to a writer. For * Write the contents of the JSONObject as JSON text to a writer. For
* compactness, no whitespace is added. * compactness, no whitespace is added.
* <p> * <p><b>
* Warning: This method assumes that the data structure is acyclical. * Warning: This method assumes that the data structure is acyclical.
* * </b>
*
* @return The writer. * @return The writer.
* @throws JSONException * @throws JSONException
*/ */
@ -2238,8 +2252,20 @@ public class JSONObject {
/** /**
* Write the contents of the JSONObject as JSON text to a writer. * Write the contents of the JSONObject as JSON text to a writer.
* <p> *
* <p>If <code>indentFactor > 0</code> and the {@link JSONObject}
* has only one key, then the object will be output on a single line:
* <pre>{@code {"key": 1}}</pre>
*
* <p>If an object has 2 or more keys, then it will be output across
* multiple lines: <code><pre>{
* "key1": 1,
* "key2": "value 2",
* "key3": 3
* }</pre></code>
* <p><b>
* Warning: This method assumes that the data structure is acyclical. * Warning: This method assumes that the data structure is acyclical.
* </b>
* *
* @param writer * @param writer
* Writes the serialized JSON * Writes the serialized JSON