|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractMap<K,V>
java.util.HashMap
org.apache.wink.json4j.JSONObject
org.apache.wink.json4j.OrderedJSONObject
public class OrderedJSONObject
Extension of the basic JSONObject. This class allows control of the serialization order of attributes.
The order in which items are put into the instance controls the order in which they are serialized out. For example, the
last item put is the last item serialized.
JSON-able values are: null, and instances of String, Boolean, Number, JSONObject and JSONArray.
Instances of this class are not thread-safe.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.util.AbstractMap |
|---|
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V> |
| Field Summary |
|---|
| Fields inherited from class org.apache.wink.json4j.JSONObject |
|---|
NULL |
| Constructor Summary | |
|---|---|
OrderedJSONObject()
Create a new instance of this class. |
|
OrderedJSONObject(java.io.InputStream is)
Create a new instance of this class from the data provided from the input stream. |
|
OrderedJSONObject(java.io.InputStream is,
boolean strict)
Create a new instance of this class from the data provided from the input stream. |
|
OrderedJSONObject(java.util.Map map)
Create a new instance of this class using the contents of the provided map. |
|
OrderedJSONObject(java.io.Reader rdr)
Create a new instance of this class from the data provided from the reader. |
|
OrderedJSONObject(java.io.Reader rdr,
boolean strict)
Create a new instance of this class from the data provided from the reader. |
|
OrderedJSONObject(java.lang.String str)
Create a new instance of this class from the provided JSON object string. |
|
OrderedJSONObject(java.lang.String str,
boolean strict)
Create a new instance of this class from the provided JSON object string. |
|
| Method Summary | |
|---|---|
void |
clear()
(non-Javadoc) |
java.lang.Object |
clone()
Returns a shallow copy of this HashMap instance: the keys and values themselves are not cloned. |
java.util.Iterator |
getOrder()
Method to obtain the order in which the items will be serialized. |
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
Method to put a JSON'able object into the instance. |
java.lang.Object |
remove(java.lang.Object key)
Method to remove an entry from the OrderedJSONObject instance. |
| Methods inherited from class org.apache.wink.json4j.JSONObject |
|---|
append, get, getBoolean, getDouble, getInt, getJSONArray, getJSONObject, getLong, getNames, getShort, getString, has, isNull, isValidObject, isValidType, keys, length, names, opt, optBoolean, optBoolean, optDouble, optDouble, optInt, optInt, optJSONArray, optJSONArray, optJSONObject, optJSONObject, optLong, optLong, optShort, optShort, optString, optString, put, put, put, put, put, put, put, put, put, put, put, put, put, putOnce, putOpt, sortedKeys, toJSONArray, toString, toString, toString, write, write, write, write, write, write, write, write, write |
| Methods inherited from class java.util.HashMap |
|---|
containsKey, containsValue, entrySet, get, isEmpty, keySet, putAll, 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 |
|---|
equals, hashCode |
| Constructor Detail |
|---|
public OrderedJSONObject()
public OrderedJSONObject(java.lang.String str)
throws JSONException
str - The String of JSON to parse
JSONException - Thrown when the string passed is null, or malformed JSON..
public OrderedJSONObject(java.lang.String str,
boolean strict)
throws JSONException
str - The String of JSON to parsestrict - Boolean flag indicating if strict mode should be used. Strict mode means comments and unquoted strings are not allowed.
JSONException - Thrown when the string passed is null, or malformed JSON..
public OrderedJSONObject(java.io.Reader rdr)
throws JSONException
rdr - The reader from which to read the JSON to parse
JSONException - Thrown when the string passed is null, or malformed JSON..
public OrderedJSONObject(java.io.Reader rdr,
boolean strict)
throws JSONException
rdr - The reader from which to read the JSON to parsestrict - Boolean flag indicating if strict mode should be used. Strict mode means comments and unquoted strings are not allowed.
JSONException - Thrown when the string passed is null, or malformed JSON..
public OrderedJSONObject(java.io.InputStream is)
throws JSONException
is - The InputStream from which to read the JSON to parse
JSONException - Thrown when the string passed is null, or malformed JSON..
public OrderedJSONObject(java.io.InputStream is,
boolean strict)
throws JSONException
is - The InputStream from which to read the JSON to parsestrict - Boolean flag indicating if strict mode should be used. Strict mode means comments and unquoted strings are not allowed.
JSONException - Thrown when the string passed is null, or malformed JSON..
public OrderedJSONObject(java.util.Map map)
throws JSONException
map - The map of key/value pairs to insert into this JSON object
JSONException - Thrown when contents in the map cannot be made JSONable.
java.lang.NullPointerException - Thrown if the map is null, or a key in the map is null..| Method Detail |
|---|
public java.lang.Object put(java.lang.Object key,
java.lang.Object value)
put in interface java.util.Mapput in class JSONObjectHashMap.put(java.lang.Object, java.lang.Object)public java.lang.Object remove(java.lang.Object key)
remove in interface java.util.Mapremove in class java.util.HashMapHashMap.remove(java.lang.Object)public void clear()
clear in interface java.util.Mapclear in class java.util.HashMapHashMap.clear()public java.lang.Object clone()
clone in class java.util.HashMappublic java.util.Iterator getOrder()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||