com.googlecode.fascinator.common
Class JsonObject

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap<K,V>
          extended by java.util.LinkedHashMap<Object,Object>
              extended by com.googlecode.fascinator.common.JsonObject
All Implemented Interfaces:
Serializable, Cloneable, Map<Object,Object>, org.json.simple.JSONAware, org.json.simple.JSONStreamAware

public class JsonObject
extends LinkedHashMap<Object,Object>
implements Map<Object,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 Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Constructor Summary
JsonObject()
           
JsonObject(Map<?,?> map)
           
 
Method Summary
static String escape(String s)
          Escape quotes, \, /, \r, \n, \b, \f, \t and other control characters (U+0000 through U+001F).
 String toJSONString()
           
static String toJSONString(Map<?,?> map)
           
 String toString()
           
static String toString(String key, Object value)
           
static void writeJSONString(Map<?,?> map, Writer out)
           
 void writeJSONString(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
 

Constructor Detail

JsonObject

public JsonObject()

JsonObject

public JsonObject(Map<?,?> map)
Method Detail

writeJSONString

public static void writeJSONString(Map<?,?> map,
                                   Writer out)
                            throws IOException
Throws:
IOException

writeJSONString

public void writeJSONString(Writer out)
                     throws IOException
Specified by:
writeJSONString in interface org.json.simple.JSONStreamAware
Throws:
IOException

toJSONString

public static String toJSONString(Map<?,?> map)

toJSONString

public String toJSONString()
Specified by:
toJSONString in interface org.json.simple.JSONAware

toString

public String toString()
Overrides:
toString in class AbstractMap<Object,Object>

toString

public static String toString(String key,
                              Object value)

escape

public static String escape(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.