Reinstate JSON license notices in datarouter
[dmaap/datarouter.git] / datarouter-prov / src / main / java / org / json / LOGJSONObject.java
index a5c32c7..2f18c54 100644 (file)
  ******************************************************************************/\r
 package org.json;\r
 \r
-\r
+/*\r
+Copyright (c) 2002 JSON.org\r
+\r
+Permission is hereby granted, free of charge, to any person obtaining a copy\r
+of this software and associated documentation files (the "Software"), to deal\r
+in the Software without restriction, including without limitation the rights\r
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r
+copies of the Software, and to permit persons to whom the Software is\r
+furnished to do so, subject to the following conditions:\r
+\r
+The above copyright notice and this permission notice shall be included in all\r
+copies or substantial portions of the Software.\r
+\r
+The Software shall be used for Good, not Evil.\r
+\r
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+SOFTWARE.\r
+*/\r
 \r
 import java.io.IOException;\r
 import java.io.StringWriter;\r
@@ -39,7 +61,60 @@ import java.util.Map;
 import java.util.ResourceBundle;\r
 import java.util.Set;\r
 \r
-\r
+/**\r
+ * A JSONObject is an unordered collection of name/value pairs. Its external\r
+ * form is a string wrapped in curly braces with colons between the names and\r
+ * values, and commas between the values and names. The internal form is an\r
+ * object having <code>get</code> and <code>opt</code> methods for accessing the\r
+ * values by name, and <code>put</code> methods for adding or replacing values\r
+ * by name. The values can be any of these types: <code>Boolean</code>,\r
+ * <code>JSONArray</code>, <code>JSONObject</code>, <code>Number</code>,\r
+ * <code>String</code>, or the <code>JSONObject.NULL</code> object. A JSONObject\r
+ * constructor can be used to convert an external form JSON text into an\r
+ * internal form whose values can be retrieved with the <code>get</code> and\r
+ * <code>opt</code> methods, or to convert values into a JSON text using the\r
+ * <code>put</code> and <code>toString</code> methods. A <code>get</code> method\r
+ * returns a value if one can be found, and throws an exception if one cannot be\r
+ * found. An <code>opt</code> method returns a default value instead of throwing\r
+ * an exception, and so is useful for obtaining optional values.\r
+ * <p>\r
+ * The generic <code>get()</code> and <code>opt()</code> methods return an\r
+ * object, which you can cast or query for type. There are also typed\r
+ * <code>get</code> and <code>opt</code> methods that do type checking and type\r
+ * coercion for you. The opt methods differ from the get methods in that they do\r
+ * not throw. Instead, they return a specified value, such as null.\r
+ * <p>\r
+ * The <code>put</code> methods add or replace values in an object. For example,\r
+ *\r
+ * <pre>\r
+ * myString = new JSONObject().put(&quot;JSON&quot;, &quot;Hello, World!&quot;).toString();\r
+ * </pre>\r
+ *\r
+ * produces the string <code>{"JSON": "Hello, World"}</code>.\r
+ * <p>\r
+ * The texts produced by the <code>toString</code> methods strictly conform to\r
+ * the JSON syntax rules. The constructors are more forgiving in the texts they\r
+ * will accept:\r
+ * <ul>\r
+ * <li>An extra <code>,</code>&nbsp;<small>(comma)</small> may appear just\r
+ * before the closing brace.</li>\r
+ * <li>Strings may be quoted with <code>'</code>&nbsp;<small>(single\r
+ * quote)</small>.</li>\r
+ * <li>Strings do not need to be quoted at all if they do not begin with a quote\r
+ * or single quote, and if they do not contain leading or trailing spaces, and\r
+ * if they do not contain any of these characters:\r
+ * <code>{ } [ ] / \ : , = ; #</code> and if they do not look like numbers and\r
+ * if they are not the reserved words <code>true</code>, <code>false</code>, or\r
+ * <code>null</code>.</li>\r
+ * <li>Keys can be followed by <code>=</code> or <code>=></code> as well as by\r
+ * <code>:</code>.</li>\r
+ * <li>Values can be followed by <code>;</code> <small>(semicolon)</small> as\r
+ * well as by <code>,</code> <small>(comma)</small>.</li>\r
+ * </ul>\r
+ *\r
+ * @author JSON.org\r
+ * @version 2012-12-01\r
+ */\r
 public class LOGJSONObject {\r
     /**\r
      * The maximum number of keys in the key pool.\r