MCPcopy Index your code
hub / github.com/processing/processing / JSONObject

Class JSONObject

core/src/processing/data/JSONObject.java:113–2282  ·  view source on GitHub ↗

A JSONObject is an unordered collection of name/value pairs. Its external form is a string wrapped in curly braces with colons between the names and values, and commas between the values and names. The internal form is an object having get and opt methods for accessing the

Source from the content-addressed store, hash-verified

111 * @see PApplet#saveJSONArray(JSONArray, String)
112 */
113public class JSONObject {
114 /**
115 * The maximum number of keys in the key pool.
116 */
117 private static final int keyPoolSize = 100;
118
119 /**
120 * Key pooling is like string interning, but without permanently tying up
121 * memory. To help conserve memory, storage of duplicated key strings in
122 * JSONObjects will be avoided by using a key pool to manage unique key
123 * string objects. This is used by JSONObject.put(string, object).
124 */
125 private static HashMap<String, Object> keyPool =
126 new HashMap<>(keyPoolSize);
127
128
129 // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
130
131
132 /**
133 * JSONObject.NULL is equivalent to the value that JavaScript calls null,
134 * whilst Java's null is equivalent to the value that JavaScript calls
135 * undefined.
136 */
137 private static final class Null {
138 /**
139 * There is only intended to be a single instance of the NULL object,
140 * so the clone method returns itself.
141 * @return NULL.
142 */
143 @Override
144 protected final Object clone() {
145 return this;
146 }
147
148 /**
149 * A Null object is equal to the null value and to itself.
150 * @param object An object to test for nullness.
151 * @return true if the object parameter is the JSONObject.NULL object
152 * or null.
153 */
154 @Override
155 public boolean equals(Object object) {
156 return object == null || object == this;
157 }
158
159 /**
160 * Get the "null" string value.
161 * @return The string "null".
162 */
163 @Override
164 public String toString() {
165 return "null";
166 }
167
168 @Override
169 public int hashCode() {
170 // TODO Auto-generated method stub

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected