com.googlecode.fascinator.common
Class JsonObject
java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<K,V>
java.util.LinkedHashMap<java.lang.Object,java.lang.Object>
com.googlecode.fascinator.common.JsonObject
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.Object,java.lang.Object>, org.json.simple.JSONAware, org.json.simple.JSONStreamAware
public class JsonObject
- extends java.util.LinkedHashMap<java.lang.Object,java.lang.Object>
- implements java.util.Map<java.lang.Object,java.lang.Object>, org.json.simple.JSONAware, org.json.simple.JSONStreamAware
This class is and all code is a direct copy of the org.json.simple.JSONObject
implementation found here:
http://json-simple.googlecode.com/svn/trunk/src/org
/json/simple/JSONObject.java
It has been duplicated for the sole purpose of moving to a LinkedHashMap to
preserve order. All credit must go to the original authors.
Because JSONValue.escape() is inaccessible from outside the original package
it needed to be added to the end of the class as well.
A JSON object. Key value pairs are unordered. JSONObject supports
java.util.Map interface.
- Author:
- FangYidong
- See Also:
- Serialized Form
| Nested classes/interfaces inherited from class java.util.AbstractMap |
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V> |
| Nested classes/interfaces inherited from interface java.util.Map |
java.util.Map.Entry<K,V> |
|
Method Summary |
static java.lang.String |
escape(java.lang.String s)
Escape quotes, \, /, \r, \n, \b, \f, \t and other control characters
(U+0000 through U+001F). |
java.lang.String |
toJSONString()
|
static java.lang.String |
toJSONString(java.util.Map<?,?> map)
|
java.lang.String |
toString()
|
static java.lang.String |
toString(java.lang.String key,
java.lang.Object value)
|
static void |
writeJSONString(java.util.Map<?,?> map,
java.io.Writer out)
|
void |
writeJSONString(java.io.Writer out)
|
| Methods inherited from class java.util.LinkedHashMap |
clear, containsValue, get, removeEldestEntry |
| Methods inherited from class java.util.HashMap |
clone, containsKey, entrySet, isEmpty, keySet, put, putAll, remove, size, values |
| Methods inherited from class java.util.AbstractMap |
equals, hashCode |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Map |
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values |
JsonObject
public JsonObject()
JsonObject
public JsonObject(java.util.Map<?,?> map)
writeJSONString
public static void writeJSONString(java.util.Map<?,?> map,
java.io.Writer out)
throws java.io.IOException
- Throws:
java.io.IOException
writeJSONString
public void writeJSONString(java.io.Writer out)
throws java.io.IOException
- Specified by:
writeJSONString in interface org.json.simple.JSONStreamAware
- Throws:
java.io.IOException
toJSONString
public static java.lang.String toJSONString(java.util.Map<?,?> map)
toJSONString
public java.lang.String toJSONString()
- Specified by:
toJSONString in interface org.json.simple.JSONAware
toString
public java.lang.String toString()
- Overrides:
toString in class java.util.AbstractMap<java.lang.Object,java.lang.Object>
toString
public static java.lang.String toString(java.lang.String key,
java.lang.Object value)
escape
public static java.lang.String escape(java.lang.String s)
- Escape quotes, \, /, \r, \n, \b, \f, \t and other control characters
(U+0000 through U+001F). It's the same as JSONValue.escape() only for
compatibility here.
- Parameters:
s -
- Returns:
- See Also:
JSONValue.escape(String)
Copyright © 2009-2013. All Rights Reserved.