Skip to content

Commit

Permalink
more JavaDoc updates
Browse files Browse the repository at this point in the history
  • Loading branch information
John J. Aylward committed Oct 2, 2018
1 parent 6661986 commit 46e7e2f
Show file tree
Hide file tree
Showing 3 changed files with 470 additions and 446 deletions.
43 changes: 27 additions & 16 deletions JSONArray.java
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,16 @@ public JSONArray(Collection<?> collection) {
}

/**
* Construct a JSONArray from an array
* Construct a JSONArray from an array.
*
* @param array
* Array. If the parameter passed is null, or not an array, an
* exception will be thrown.
*
* @throws JSONException
* If not an array or if an array value is non-finite number.
* If not an array or if an array value is non-finite number.
* @throws NullPointerException
* Thrown if the array parameter is null.
*/
public JSONArray(Object array) throws JSONException {
this();
Expand Down Expand Up @@ -310,17 +316,19 @@ public Number getNumber(int index) throws JSONException {
}

/**
* Get the enum value associated with an index.
*
* @param clazz
* The type of enum to retrieve.
* @param index
* The index must be between 0 and length() - 1.
* @return The enum value at the index location
* @throws JSONException
* if the key is not found or if the value cannot be converted
* to an enum.
*/
* Get the enum value associated with an index.
*
* @param <E>
* Enum Type
* @param clazz
* The type of enum to retrieve.
* @param index
* The index must be between 0 and length() - 1.
* @return The enum value at the index location
* @throws JSONException
* if the key is not found or if the value cannot be converted
* to an enum.
*/
public <E extends Enum<E>> E getEnum(Class<E> clazz, int index) throws JSONException {
E val = optEnum(clazz, index);
if(val==null) {
Expand Down Expand Up @@ -686,6 +694,8 @@ public int optInt(int index, int defaultValue) {
/**
* Get the enum value associated with a key.
*
* @param <E>
* Enum Type
* @param clazz
* The type of enum to retrieve.
* @param index
Expand All @@ -699,6 +709,8 @@ public <E extends Enum<E>> E optEnum(Class<E> clazz, int index) {
/**
* Get the enum value associated with a key.
*
* @param <E>
* Enum Type
* @param clazz
* The type of enum to retrieve.
* @param index
Expand Down Expand Up @@ -728,7 +740,6 @@ public <E extends Enum<E>> E optEnum(Class<E> clazz, int index, E defaultValue)
}
}


/**
* Get the optional BigInteger value associated with an index. The
* defaultValue is returned if there is no value for the index, or if the
Expand Down Expand Up @@ -1198,8 +1209,8 @@ public Object query(String jsonPointer) {
}

/**
* Uses a uaer initialized JSONPointer and tries to
* match it to an item whithin this JSONArray. For example, given a
* Uses a user initialized JSONPointer and tries to
* match it to an item within this JSONArray. For example, given a
* JSONArray initialized with this document:
* <pre>
* [
Expand Down
47 changes: 30 additions & 17 deletions JSONObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -576,17 +576,19 @@ public Object get(String key) throws JSONException {
}

/**
* Get the enum value associated with a key.
*
* @param clazz
* The type of enum to retrieve.
* @param key
* A key string.
* @return The enum value associated with the key
* @throws JSONException
* if the key is not found or if the value cannot be converted
* to an enum.
*/
* Get the enum value associated with a key.
*
* @param <E>
* Enum Type
* @param clazz
* The type of enum to retrieve.
* @param key
* A key string.
* @return The enum value associated with the key
* @throws JSONException
* if the key is not found or if the value cannot be converted
* to an enum.
*/
public <E extends Enum<E>> E getEnum(Class<E> clazz, String key) throws JSONException {
E val = optEnum(clazz, key);
if(val==null) {
Expand Down Expand Up @@ -814,6 +816,8 @@ public long getLong(String key) throws JSONException {
/**
* Get an array of field names from a JSONObject.
*
* @param jo
* JSON object
* @return An array of field names, or null if there are no names.
*/
public static String[] getNames(JSONObject jo) {
Expand All @@ -824,8 +828,10 @@ public static String[] getNames(JSONObject jo) {
}

/**
* Get an array of field names from an Object.
* Get an array of public field names from an Object.
*
* @param object
* object to read
* @return An array of field names, or null if there are no names.
*/
public static String[] getNames(Object object) {
Expand Down Expand Up @@ -1036,6 +1042,8 @@ public Object opt(String key) {
/**
* Get the enum value associated with a key.
*
* @param <E>
* Enum Type
* @param clazz
* The type of enum to retrieve.
* @param key
Expand All @@ -1049,6 +1057,8 @@ public <E extends Enum<E>> E optEnum(Class<E> clazz, String key) {
/**
* Get the enum value associated with a key.
*
* @param <E>
* Enum Type
* @param clazz
* The type of enum to retrieve.
* @param key
Expand Down Expand Up @@ -1861,8 +1871,10 @@ public JSONObject put(String key, Object value) throws JSONException {
* are both non-null, and only if there is not already a member with that
* name.
*
* @param key string
* @param value object
* @param key
* key to insert into
* @param value
* value to insert
* @return this.
* @throws JSONException
* if the key is a duplicate
Expand Down Expand Up @@ -1973,9 +1985,10 @@ public Object optQuery(JSONPointer jsonPointer) {

/**
* Produce a string in double quotes with backslash sequences in all the
* right places. A backslash will be inserted within </, producing <\/,
* allowing JSON text to be delivered in HTML. In JSON text, a string cannot
* contain a control character or an unescaped quote or backslash.
* right places. A backslash will be inserted within &lt;/, producing
* &lt;\/, allowing JSON text to be delivered in HTML. In JSON text, a
* string cannot contain a control character or an unescaped quote or
* backslash.
*
* @param string
* A String
Expand Down
Loading

0 comments on commit 46e7e2f

Please sign in to comment.