diff --git a/Core/src/main/java/com/intellectualcrafters/configuration/ConfigurationSection.java b/Core/src/main/java/com/intellectualcrafters/configuration/ConfigurationSection.java index 661898269..496a2775a 100644 --- a/Core/src/main/java/com/intellectualcrafters/configuration/ConfigurationSection.java +++ b/Core/src/main/java/com/intellectualcrafters/configuration/ConfigurationSection.java @@ -27,12 +27,12 @@ public interface ConfigurationSection { /** * Gets a Map containing all keys and their values for this section. - *
- * If deep is set to true, then this will contain all the keys and values + * + *
If deep is set to true, then this will contain all the keys and values * within any child {@link ConfigurationSection}s (and their children, * etc). These keys will be in a valid path notation for you to use. - *
- * If deep is set to false, then this will contain only the keys and + * + *
If deep is set to false, then this will contain only the keys and
* values of any direct children, and not their own children.
*
* @param deep Whether or not to get a deep list, as opposed to a shallow
@@ -49,8 +49,8 @@ public interface ConfigurationSection {
*
* @param path Path to check for existence.
* @return True if this section contains the requested path, either via
- * default or being set.
- * @throws IllegalArgumentException Thrown when path is null
.
+ * default or being set.
+ * @throws IllegalArgumentException Thrown when path is {@code null}.
*/
boolean contains(String path);
@@ -64,7 +64,7 @@ public interface ConfigurationSection {
* @param path Path to check for existence.
* @return True if this section contains the requested path, regardless of
* having a default.
- * @throws IllegalArgumentException Thrown when path is null
.
+ * @throws IllegalArgumentException Thrown when path is {@code null}.
*/
boolean isSet(String path);
@@ -77,7 +77,7 @@ public interface ConfigurationSection {
*
*
If the section is no longer contained within its root for any reason,
* such as being replaced with a different value,
- * this may return null
.
+ * this may return {@code null}.
*
*
To retrieve the single name of this section, that is, the final part * of the path returned by this method, you may use {@link #getName()}. @@ -106,7 +106,7 @@ public interface ConfigurationSection { * *
If the section is no longer contained within its root for any reason,
* such as being replaced with a different value,
- * this may return null
.
+ * this may return {@code null}.
*
* @return Root configuration containing this section.
*/
@@ -117,11 +117,11 @@ public interface ConfigurationSection {
* this {@link ConfigurationSection}.
*
*
For any {@link Configuration} themselves, this will return
- * null
.
+ * {@code null}.
*
- *
If the section is no longer contained within its parent for any reason,
- * such as being replaced with a different value, this may
- * return null
.
+ *
If the section is no longer contained within its parent for any + * reason, such as being replaced with a different value, this may + * return {@code null}. * * @return Parent section containing this section. */ @@ -132,7 +132,7 @@ public interface ConfigurationSection { * *
If the Object does not exist but a default value has been specified,
* this will return the default value. If the Object does not exist and no
- * default value was specified, this will return null
.
+ * default value was specified, this will return {@code null}.
*
* @param path Path of the Object to get.
* @return Requested Object.
@@ -156,7 +156,7 @@ public interface ConfigurationSection {
/**
* Sets the specified path to the given value.
*
- *
If value is null
, the entry will be removed. Any
+ *
If value is {@code null}, the entry will be removed. Any * existing entry will be replaced, regardless of what the new value is. * *
Some implementations may have limitations on what you may store. See @@ -202,7 +202,7 @@ public interface ConfigurationSection { * *
If the String does not exist but a default value has been specified,
* this will return the default value. If the String does not exist and no
- * default value was specified, this will return null
.
+ * default value was specified, this will return {@code null}.
*
* @param path Path of the String to get.
* @return Requested String.
@@ -470,13 +470,13 @@ public interface ConfigurationSection {
/**
* Gets the requested List of Boolean by path.
- *
- * If the List does not exist but a default value has been specified, this - * will return the default value. If the List does not exist and no + * + *
If the List does not exist but a default value has been specified, + * this will return the default value. If the List does not exist and no * default value was specified, this will return an empty List. - *
- * This method will attempt to cast any values into a Boolean if possible, - * but may miss any values out if they are not compatible. + * + *
This method will attempt to cast any values into a Boolean if + * possible, but may miss any values out if they are not compatible. * * @param path Path of the List to get. * @return Requested List of Boolean. @@ -485,12 +485,12 @@ public interface ConfigurationSection { /** * Gets the requested List of Double by path. - *
- * If the List does not exist but a default value has been specified, this - * will return the default value. If the List does not exist and no + * + *
If the List does not exist but a default value has been specified, + * this will return the default value. If the List does not exist and no * default value was specified, this will return an empty List. - *
- * This method will attempt to cast any values into a Double if possible, + * + *
This method will attempt to cast any values into a Double if possible, * but may miss any values out if they are not compatible. * * @param path Path of the List to get. @@ -500,12 +500,12 @@ public interface ConfigurationSection { /** * Gets the requested List of Float by path. - *
- * If the List does not exist but a default value has been specified, this - * will return the default value. If the List does not exist and no + * + *
If the List does not exist but a default value has been specified, + * this will return the default value. If the List does not exist and no * default value was specified, this will return an empty List. - *
- * This method will attempt to cast any values into a Float if possible, + * + *
This method will attempt to cast any values into a Float if possible, * but may miss any values out if they are not compatible. * * @param path Path of the List to get. @@ -515,12 +515,12 @@ public interface ConfigurationSection { /** * Gets the requested List of Long by path. - *
- * If the List does not exist but a default value has been specified, this - * will return the default value. If the List does not exist and no + * + *
If the List does not exist but a default value has been specified, + * this will return the default value. If the List does not exist and no * default value was specified, this will return an empty List. - *
- * This method will attempt to cast any values into a Long if possible, + * + *
This method will attempt to cast any values into a Long if possible, * but may miss any values out if they are not compatible. * * @param path Path of the List to get. @@ -530,12 +530,12 @@ public interface ConfigurationSection { /** * Gets the requested List of Byte by path. - *
- * If the List does not exist but a default value has been specified, this - * will return the default value. If the List does not exist and no + * + *
If the List does not exist but a default value has been specified, + * this will return the default value. If the List does not exist and no * default value was specified, this will return an empty List. - *
- * This method will attempt to cast any values into a Byte if possible, + * + *
This method will attempt to cast any values into a Byte if possible, * but may miss any values out if they are not compatible. * * @param path Path of the List to get. @@ -545,12 +545,12 @@ public interface ConfigurationSection { /** * Gets the requested List of Character by path. - *
- * If the List does not exist but a default value has been specified, this - * will return the default value. If the List does not exist and no + * + *
If the List does not exist but a default value has been specified, + * this will return the default value. If the List does not exist and no * default value was specified, this will return an empty List. - *
- * This method will attempt to cast any values into a Character if + * + *
This method will attempt to cast any values into a Character if * possible, but may miss any values out if they are not compatible. * * @param path Path of the List to get. @@ -560,11 +560,13 @@ public interface ConfigurationSection { /** * Gets the requested List of Short by path. - *
If the List does not exist but a default value has been specified, this - * will return the default value. If the List does not exist and no + * + *
If the List does not exist but a default value has been specified, + * this will return the default value. If the List does not exist and no * default value was specified, this will return an empty List. - *
This method will attempt to cast any values into a Short if possible, - * but may miss any values out if they are not compatible. + * + *
This method will attempt to cast any values into a Short if + * possible, but may miss any values out if they are not compatible. * * @param path Path of the List to get. * @return Requested List of Short. @@ -591,7 +593,7 @@ public interface ConfigurationSection { *
If the ConfigurationSection does not exist but a default value has
* been specified, this will return the default value. If the
* ConfigurationSection does not exist and no default value was specified,
- * this will return null
.
+ * this will return {@code null}.
*
* @param path Path of the ConfigurationSection to get.
* @return Requested ConfigurationSection.
@@ -618,7 +620,7 @@ public interface ConfigurationSection {
*
*
If the root contains no defaults, or the defaults doesn't contain a
* value for this path, or the value at this path is not a {@link
- * ConfigurationSection} then this will return null
.
+ * ConfigurationSection} then this will return {@code null}.
*
* @return Equivalent section in root configuration
*/
@@ -631,16 +633,16 @@ public interface ConfigurationSection {
* collection, then a new {@link MemoryConfiguration} will be created to
* hold the new default value.
*
- *
If value is null
, the value will be removed from the
+ *
If value is {@code null}, the value will be removed from the * default Configuration source. * *
If the value as returned by {@link #getDefaultSection()} is
- * null
, then this will create a new section at the path,
+ * {@code null}, then this will create a new section at the path,
* replacing anything that may have existed there previously.
*
* @param path Path of the value to set
* @param value Value to set the default to
- * @throws IllegalArgumentException Thrown if path is null
+ * @throws IllegalArgumentException Thrown if path is {@code null}
*/
void addDefault(String path, Object value);
}
diff --git a/Core/src/main/java/com/intellectualcrafters/configuration/MemorySection.java b/Core/src/main/java/com/intellectualcrafters/configuration/MemorySection.java
index 8aad3c8d9..d2e0aafa3 100644
--- a/Core/src/main/java/com/intellectualcrafters/configuration/MemorySection.java
+++ b/Core/src/main/java/com/intellectualcrafters/configuration/MemorySection.java
@@ -74,7 +74,8 @@ public class MemorySection implements ConfigurationSection {
if (obj instanceof String) {
try {
return Double.parseDouble((String) obj);
- } catch (NumberFormatException ignored) {}
+ } catch (NumberFormatException ignored) {
+ }
} else if (obj instanceof List) {
List> val = (List>) obj;
if (!val.isEmpty()) {
@@ -91,7 +92,8 @@ public class MemorySection implements ConfigurationSection {
if (obj instanceof String) {
try {
return Integer.parseInt((String) obj);
- } catch (NumberFormatException ignored) {}
+ } catch (NumberFormatException ignored) {
+ }
} else if (obj instanceof List) {
List> val = (List>) obj;
if (!val.isEmpty()) {
@@ -108,7 +110,8 @@ public class MemorySection implements ConfigurationSection {
if (obj instanceof String) {
try {
return Long.parseLong((String) obj);
- } catch (NumberFormatException ignored) {}
+ } catch (NumberFormatException ignored) {
+ }
} else if (obj instanceof List) {
List> val = (List>) obj;
if (!val.isEmpty()) {
@@ -565,7 +568,8 @@ public class MemorySection implements ConfigurationSection {
} else if (object instanceof String) {
try {
result.add(Integer.valueOf((String) object));
- } catch (NumberFormatException ignored) {}
+ } catch (NumberFormatException ignored) {
+ }
} else if (object instanceof Character) {
result.add((int) (Character) object);
} else if (object instanceof Number) {
@@ -609,7 +613,8 @@ public class MemorySection implements ConfigurationSection {
} else if (object instanceof String) {
try {
result.add(Double.valueOf((String) object));
- } catch (NumberFormatException ignored) {}
+ } catch (NumberFormatException ignored) {
+ }
} else if (object instanceof Character) {
result.add((double) (Character) object);
} else if (object instanceof Number) {
@@ -632,7 +637,8 @@ public class MemorySection implements ConfigurationSection {
} else if (object instanceof String) {
try {
result.add(Float.valueOf((String) object));
- } catch (NumberFormatException ignored) {}
+ } catch (NumberFormatException ignored) {
+ }
} else if (object instanceof Character) {
result.add((float) (Character) object);
} else if (object instanceof Number) {
@@ -655,7 +661,8 @@ public class MemorySection implements ConfigurationSection {
} else if (object instanceof String) {
try {
result.add(Long.valueOf((String) object));
- } catch (NumberFormatException ignored) {}
+ } catch (NumberFormatException ignored) {
+ }
} else if (object instanceof Character) {
result.add((long) (Character) object);
} else if (object instanceof Number) {
@@ -678,7 +685,8 @@ public class MemorySection implements ConfigurationSection {
} else if (object instanceof String) {
try {
result.add(Byte.valueOf((String) object));
- } catch (NumberFormatException ignored) {}
+ } catch (NumberFormatException ignored) {
+ }
} else if (object instanceof Character) {
result.add((byte) ((Character) object).charValue());
} else if (object instanceof Number) {
@@ -724,7 +732,8 @@ public class MemorySection implements ConfigurationSection {
} else if (object instanceof String) {
try {
result.add(Short.valueOf((String) object));
- } catch (NumberFormatException ignored) {}
+ } catch (NumberFormatException ignored) {
+ }
} else if (object instanceof Character) {
result.add((short) ((Character) object).charValue());
} else if (object instanceof Number) {
@@ -833,7 +842,10 @@ public class MemorySection implements ConfigurationSection {
@Override
public String toString() {
Configuration root = getRoot();
- return getClass().getSimpleName() + "[path='" + getCurrentPath() + "', root='" + (root == null ? null : root.getClass().getSimpleName()) +
- "']";
+ if (root == null) {
+ return getClass().getSimpleName() + "[path='" + getCurrentPath() + "', root='" + null + "']";
+ } else {
+ return getClass().getSimpleName() + "[path='" + getCurrentPath() + "', root='" + root.getClass().getSimpleName() + "']";
+ }
}
}
diff --git a/Core/src/main/java/com/intellectualcrafters/configuration/file/FileConfigurationOptions.java b/Core/src/main/java/com/intellectualcrafters/configuration/file/FileConfigurationOptions.java
index d99eab2da..a2c1c19e6 100644
--- a/Core/src/main/java/com/intellectualcrafters/configuration/file/FileConfigurationOptions.java
+++ b/Core/src/main/java/com/intellectualcrafters/configuration/file/FileConfigurationOptions.java
@@ -42,8 +42,8 @@ public class FileConfigurationOptions extends MemoryConfigurationOptions {
* automatically be applied, but you may include one if you wish for extra
* spacing.
*
- *
null
is a valid value which will indicate that no header]
- * is to be applied. The default value is null
.
+ *
{@code null} is a valid value which will indicate that no header] + * is to be applied. The default value is {@code null}. * * @return Header */ @@ -60,7 +60,7 @@ public class FileConfigurationOptions extends MemoryConfigurationOptions { * automatically be applied, but you may include one if you wish for extra * spacing. * - *
null
is a valid value which will indicate that no header
+ *
{@code null} is a valid value which will indicate that no header * is to be applied. * * @param value New header diff --git a/Core/src/main/java/com/intellectualcrafters/configuration/file/YamlConfigurationOptions.java b/Core/src/main/java/com/intellectualcrafters/configuration/file/YamlConfigurationOptions.java index d33416387..242b40640 100644 --- a/Core/src/main/java/com/intellectualcrafters/configuration/file/YamlConfigurationOptions.java +++ b/Core/src/main/java/com/intellectualcrafters/configuration/file/YamlConfigurationOptions.java @@ -2,12 +2,12 @@ package com.intellectualcrafters.configuration.file; /** * Various settings for controlling the input and output of a {@link - * YamlConfiguration} + * YamlConfiguration}. */ public class YamlConfigurationOptions extends FileConfigurationOptions { private int indent = 2; - YamlConfigurationOptions(final YamlConfiguration configuration) { + YamlConfigurationOptions(YamlConfiguration configuration) { super(configuration); } @@ -17,33 +17,33 @@ public class YamlConfigurationOptions extends FileConfigurationOptions { } @Override - public YamlConfigurationOptions copyDefaults(final boolean value) { + public YamlConfigurationOptions copyDefaults(boolean value) { super.copyDefaults(value); return this; } @Override - public YamlConfigurationOptions pathSeparator(final char value) { + public YamlConfigurationOptions pathSeparator(char value) { super.pathSeparator(value); return this; } @Override - public YamlConfigurationOptions header(final String value) { + public YamlConfigurationOptions header(String value) { super.header(value); return this; } @Override - public YamlConfigurationOptions copyHeader(final boolean value) { + public YamlConfigurationOptions copyHeader(boolean value) { super.copyHeader(value); return this; } /** * Gets how much spaces should be used to indent each line. - *
- * The minimum value this may be is 2, and the maximum is 9. + * + *
The minimum value this may be is 2, and the maximum is 9. * * @return How much to indent by */ @@ -53,13 +53,13 @@ public class YamlConfigurationOptions extends FileConfigurationOptions { /** * Sets how much spaces should be used to indent each line. - *
- * The minimum value this may be is 2, and the maximum is 9. + * + *
The minimum value this may be is 2, and the maximum is 9. * * @param value New indent * @return This object, for chaining */ - public YamlConfigurationOptions indent(final int value) { + public YamlConfigurationOptions indent(int value) { if (value < 2) { throw new IllegalArgumentException("Indent must be at least 2 characters"); } diff --git a/Core/src/main/java/com/intellectualcrafters/configuration/file/YamlRepresenter.java b/Core/src/main/java/com/intellectualcrafters/configuration/file/YamlRepresenter.java index 61eecfa1c..e130e5d94 100644 --- a/Core/src/main/java/com/intellectualcrafters/configuration/file/YamlRepresenter.java +++ b/Core/src/main/java/com/intellectualcrafters/configuration/file/YamlRepresenter.java @@ -11,7 +11,7 @@ import java.util.Map; class YamlRepresenter extends Representer { - public YamlRepresenter() { + YamlRepresenter() { this.multiRepresenters.put(ConfigurationSection.class, new RepresentConfigurationSection()); this.multiRepresenters.put(ConfigurationSerializable.class, new RepresentConfigurationSerializable()); } diff --git a/Core/src/main/java/com/intellectualcrafters/configuration/serialization/ConfigurationSerializable.java b/Core/src/main/java/com/intellectualcrafters/configuration/serialization/ConfigurationSerializable.java index 7ee49ae5f..fed1b35b9 100644 --- a/Core/src/main/java/com/intellectualcrafters/configuration/serialization/ConfigurationSerializable.java +++ b/Core/src/main/java/com/intellectualcrafters/configuration/serialization/ConfigurationSerializable.java @@ -4,9 +4,8 @@ import java.util.Map; /** * Represents an object that may be serialized. - *
- * These objects MUST implement one of the following, in addition to the - * methods as defined by this interface: + *
These objects MUST implement one of the following, in addition to + * the methods as defined by this interface: *
- * This class must provide a method to restore this class, as defined in + * + *
This class must provide a method to restore this class, as defined in * the {@link ConfigurationSerializable} interface javadoc. * * @return Map containing the current state of this class diff --git a/Core/src/main/java/com/intellectualcrafters/jnbt/NBTOutputStream.java b/Core/src/main/java/com/intellectualcrafters/jnbt/NBTOutputStream.java index d5a052778..0ec56f364 100644 --- a/Core/src/main/java/com/intellectualcrafters/jnbt/NBTOutputStream.java +++ b/Core/src/main/java/com/intellectualcrafters/jnbt/NBTOutputStream.java @@ -7,10 +7,11 @@ import java.io.OutputStream; import java.util.List; /** - *
This class writes NBT, or Named Binary Tag Tag
objects to an
- * underlying OutputStream
.
The NBT format was created by Markus Persson, and the - * specification may be found at - * @linktourl http://www.minecraft.net/docs/NBT.txt + * This class writes NBT, or Named Binary Tag + * {@code Tag} objects to an underlying {@code OutputStream}. + * + *
The NBT format was created by Markus Persson, and the specification may + * be found at @linktourl http://www.minecraft.net/docs/NBT.txt *
* * @author Graham Edgecombe @@ -23,7 +24,8 @@ public final class NBTOutputStream implements Closeable { private final DataOutputStream os; /** - * Creates a newNBTOutputStream
, which will write data to the specified underlying output stream.
+ * Creates a new {@code NBTOutputStream}, which will write data to the
+ * specified underlying output stream.
*
* @param os The output stream.
*
@@ -105,7 +107,7 @@ public final class NBTOutputStream implements Closeable {
}
/**
- * Writes a TAG_Byte
tag.
+ * Writes a {@code TAG_Byte} tag.
*
* @param tag The tag.
*
@@ -116,7 +118,7 @@ public final class NBTOutputStream implements Closeable {
}
/**
- * Writes a TAG_Byte_Array
tag.
+ * Writes a {@code TAG_Byte_Array} tag.
*
* @param tag The tag.
*
@@ -129,7 +131,7 @@ public final class NBTOutputStream implements Closeable {
}
/**
- * Writes a TAG_Compound
tag.
+ * Writes a {@code TAG_Compound} tag.
*
* @param tag The tag.
*
@@ -143,7 +145,7 @@ public final class NBTOutputStream implements Closeable {
}
/**
- * Writes a TAG_List
tag.
+ * Writes a {@code TAG_List} tag.
*
* @param tag The tag.
*
@@ -161,7 +163,7 @@ public final class NBTOutputStream implements Closeable {
}
/**
- * Writes a TAG_String
tag.
+ * Writes a {@code TAG_String} tag.
*
* @param tag The tag.
*
@@ -174,7 +176,7 @@ public final class NBTOutputStream implements Closeable {
}
/**
- * Writes a TAG_Double
tag.
+ * Writes a {@code TAG_Double} tag.
*
* @param tag The tag.
*
@@ -185,7 +187,7 @@ public final class NBTOutputStream implements Closeable {
}
/**
- * Writes a TAG_Float
tag.
+ * Writes a {@code TAG_Float} tag.
*
* @param tag The tag.
*
@@ -196,7 +198,7 @@ public final class NBTOutputStream implements Closeable {
}
/**
- * Writes a TAG_Long
tag.
+ * Writes a {@code TAG_Long} tag.
*
* @param tag The tag.
*
@@ -207,7 +209,7 @@ public final class NBTOutputStream implements Closeable {
}
/**
- * Writes a TAG_Int
tag.
+ * Writes a {@code TAG_Int} tag.
*
* @param tag The tag.
*
@@ -218,7 +220,7 @@ public final class NBTOutputStream implements Closeable {
}
/**
- * Writes a TAG_Short
tag.
+ * Writes a {@code TAG_Short} tag.
*
* @param tag The tag.
*
@@ -229,7 +231,7 @@ public final class NBTOutputStream implements Closeable {
}
/**
- * Writes a TAG_Empty
tag.
+ * Writes a {@code TAG_Empty} tag.
*
* @param tag The tag.
*/
@@ -251,7 +253,7 @@ public final class NBTOutputStream implements Closeable {
}
/**
- * Flush output
+ * Flush output.
* @throws IOException
*/
public void flush() throws IOException {
diff --git a/Core/src/main/java/com/intellectualcrafters/json/Cookie.java b/Core/src/main/java/com/intellectualcrafters/json/Cookie.java
index 6c753252d..ef58c8e8a 100644
--- a/Core/src/main/java/com/intellectualcrafters/json/Cookie.java
+++ b/Core/src/main/java/com/intellectualcrafters/json/Cookie.java
@@ -107,9 +107,9 @@ public class Cookie {
}
/**
- * Convert %
hh sequences to single characters, and convert plus to space.
+ * Convert {@code %}hh sequences to single characters, and convert plus to space.
*
- * @param string A string that may contain +
(plus) and %
hh
+ * @param string A string that may contain {@code +} (plus) and %
hh
* sequences.
*
* @return The unescaped string.
diff --git a/Core/src/main/java/com/intellectualcrafters/json/JSONArray.java b/Core/src/main/java/com/intellectualcrafters/json/JSONArray.java
index d46fdc3d9..32b75bd01 100644
--- a/Core/src/main/java/com/intellectualcrafters/json/JSONArray.java
+++ b/Core/src/main/java/com/intellectualcrafters/json/JSONArray.java
@@ -10,28 +10,28 @@ import java.util.Map;
/**
* A JSONArray is an ordered sequence of values. Its external text form is a string wrapped in square brackets with
- * commas separating the values. The internal form is an object having get
and opt
methods for
- * accessing the values by index, and put
methods for adding or replacing values. The values can be any of
- * these types: Boolean
, JSONArray
, JSONObject
, Number
,
- * String
, or the JSONObject.NULL object
.
+ * commas separating the values. The internal form is an object having {@code get} and {@code opt} methods for
+ * accessing the values by index, and {@code put} methods for adding or replacing values. The values can be any of
+ * these types: {@code Boolean}, {@code JSONArray}, {@code JSONObject}, {@code Number},
+ * {@code String}, or the {@code JSONObject.NULL object}.
*
- * The constructor can convert a JSON text into a Java object. The toString
method converts to JSON text.
+ * The constructor can convert a JSON text into a Java object. The {@code toString} method converts to JSON text.
*
- * A get
method returns a value if one can be found, and throws an exception if one cannot be found. An
- * opt
method returns a default value instead of throwing an exception, and so is useful for obtaining
+ *
A {@code get} method returns a value if one can be found, and throws an exception if one cannot be found. An
+ * {@code opt} method returns a default value instead of throwing an exception, and so is useful for obtaining
* optional values.
*
- * The generic get()
and opt()
methods return an object which you can cast or query for type.
- * There are also typed get
and opt
methods that do type checking and type coercion for you.
+ *
The generic {@code get()} and {@code opt()} methods return an object which you can cast or query for type.
+ * There are also typed {@code get} and {@code opt} methods that do type checking and type coercion for you.
*
- * The texts produced by the toString
methods strictly conform to JSON syntax rules. The constructors are
- * more forgiving in the texts they will accept:
,
(comma) may appear
- * just before the closing bracket.null
value will be inserted when there is ,
- * (comma) elision.'
(single
+ * The texts produced by the {@code toString} methods strictly conform to JSON syntax rules. The constructors are + * more forgiving in the texts they will accept:
{ }
- * [ ] / \ : , #
and if they do not look like numbers and if they are not the reserved words true
,
- * false
, or null
.[
(left bracket) and ends with
- * ]
(right bracket).
+ * @param source A string that begins with {@code [} (left bracket) and ends with
+ * {@code ]} (right bracket).
*
* @throws JSONException If there is a syntax error.
*/
@@ -283,7 +283,7 @@ public class JSONArray {
}
/**
- * Make a string from the contents of this JSONArray. The separator
string is inserted between each
+ * Make a string from the contents of this JSONArray. The {@code separator} string is inserted between each
* element. Warning: This method assumes that the data structure is acyclical.
*
* @param separator A string that will be inserted between the elements.
@@ -449,10 +449,11 @@ public class JSONArray {
}
/**
- * Get the optional long value associated with an index. The defaultValue is returned if there is no value for the
- * index, or if the value is not a number and cannot be converted to a number.
+ * Get the optional long value associated with an index. The defaultValue
+ * is returned if there is no value for the index, or if the value is not a
+ * number and cannot be converted to a number.
*
- * @param index The index must be between 0 and length() - 1.
+ * @param index The index must be between 0 and length() - 1.
* @param defaultValue The default value.
*
* @return The value.
@@ -466,8 +467,9 @@ public class JSONArray {
}
/**
- * Get the optional string value associated with an index. It returns an empty string if there is no value at that
- * index. If the value is not a string and is not null, then it is converted to a string.
+ * Get the optional string value associated with an index. It returns an
+ * empty string if there is no value at that index. If the value is not a
+ * string and is not null, then it is converted to a string.
*
* @param index The index must be between 0 and length() - 1.
*
@@ -478,7 +480,8 @@ public class JSONArray {
}
/**
- * Get the optional string associated with an index. The defaultValue is returned if the key is not found.
+ * Get the optional string associated with an index. The defaultValue is
+ * returned if the key is not found.
*
* @param index The index must be between 0 and length() - 1.
* @param defaultValue The default value.
@@ -503,7 +506,8 @@ public class JSONArray {
}
/**
- * Put a value in the JSONArray, where the value will be a JSONArray which is produced from a Collection.
+ * Put a value in the JSONArray, where the value will be a JSONArray which
+ * is produced from a Collection.
*
* @param value A Collection value.
*
@@ -555,7 +559,8 @@ public class JSONArray {
}
/**
- * Put a value in the JSONArray, where the value will be a JSONObject which is produced from a Map.
+ * Put a value in the JSONArray, where the value will be a JSONObject which
+ * is produced from a Map.
*
* @param value A Map value.
*
@@ -569,8 +574,8 @@ public class JSONArray {
/**
* Append an object value. This increases the array's length by one.
*
- * @param value An object value. The value should be a Boolean, Double, Integer, JSONArray, JSONObject, Long, or
- * String, or the JSONObject.NULL object.
+ * @param value An object value. The value should be a Boolean, Double,
+ * Integer, JSONArray, JSONObject, Long, or String, or the JSONObject.NULL object.
*
* @return this.
*/
@@ -596,14 +601,16 @@ public class JSONArray {
}
/**
- * Put a value in the JSONArray, where the value will be a JSONArray which is produced from a Collection.
+ * 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.
+ * @throws JSONException If the index is negative or if the value is not
+ * finite.
*/
public JSONArray put(int index, Collection