Package io.keikai.json
Class JSONObject<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<K,V>
java.util.LinkedHashMap<K,V>
io.keikai.json.JSONObject<K,V>
- All Implemented Interfaces:
JSONAware,Serializable,Cloneable,Map<K,V>
A JSON object. Key value pairs are in the order of adding.
JSONObject supports java.util.Map interface.
- Author:
- FangYidong<fangyidong@yahoo.com.cn>
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> -
Constructor Summary
ConstructorsConstructorDescriptionJSONObject(int initialCapacity) JSONObject(int initialCapacity, float loadFactor) JSONObject(int initialCapacity, float loadFactor, boolean accessOrder) JSONObject(Map<? extends K, ? extends V> m) JSONObject(K key, V value) -
Method Summary
Methods inherited from class java.util.LinkedHashMap
clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, removeEldestEntry, replaceAll, valuesMethods inherited from class java.util.HashMap
clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, sizeMethods inherited from class java.util.AbstractMap
equals, hashCodeMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Map
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
-
Constructor Details
-
JSONObject
public JSONObject() -
JSONObject
public JSONObject(int initialCapacity, float loadFactor) -
JSONObject
public JSONObject(int initialCapacity) -
JSONObject
-
JSONObject
public JSONObject(int initialCapacity, float loadFactor, boolean accessOrder) -
JSONObject
-
-
Method Details
-
toJSONString
Convert (aka., encode) a map to JSON text. The result is a JSON object. If this map is also a JSONAware, JSONAware specific behaviors will be omitted at this top level.- Parameters:
map-- Returns:
- JSON text, or "null" if map is null.
- See Also:
-
toJSONString
Encodes this object to a JSON string. It is the same astoString().- Specified by:
toJSONStringin interfaceJSONAware- Returns:
- JSON text
-
toString
Encodes this object to a JSON string. It is the same astoJSONString().- Overrides:
toStringin classAbstractMap<K,V>
-
toString
-