net.rim.device.api.io.parser.json
Class JSONHashtable

java.lang.Object
  extended by java.util.Hashtable
      extended by net.rim.device.api.io.parser.ObjectPathHashtableBase
          extended by net.rim.device.api.io.parser.json.JSONHashtable
All Implemented Interfaces:
ObjectPathHashtable, Persistable

public class JSONHashtable
extends ObjectPathHashtableBase

This class allows a user to access a JSON object tree using a Hashtable interface. The entire JSON is read and the leaf nodes are inserted into this JSONHashtable. Additional methods are provided to convert return values into specific types, if desired, via the ObjectPathHashtable interface.

Since:
BlackBerry API 6.0.0

Constructor Summary
JSONHashtable(JSONArray jsonArray)
          Constructs a JSONHashtable from a JSONArray.
JSONHashtable(JSONObject jsonObject)
          Constructs a JSONHashtable from a JSONObject.
 
Method Summary
 
Methods inherited from class net.rim.device.api.io.parser.ObjectPathHashtableBase
addString, getBoolean, getBoolean, getBooleanArray, getBooleanAt, getBooleanAt, getByte, getByte, getByteArray, getByteAt, getByteAt, getDouble, getDouble, getDoubleArray, getDoubleAt, getDoubleAt, getFloat, getFloat, getFloatArray, getFloatAt, getFloatAt, getInteger, getInteger, getInteger, getIntegerArray, getIntegerAt, getIntegerAt, getIntegerAt, getLong, getLong, getLongArray, getLongAt, getLongAt, getNumKeys, getNumValues, getShort, getShort, getShortArray, getShortAt, getShortAt, getString, getString, getStringArray, getStringAt, getStringAt
 
Methods inherited from class java.util.Hashtable
clear, contains, containsKey, elements, get, isEmpty, keys, put, rehash, remove, size, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 



Constructor Detail

JSONHashtable

public JSONHashtable(JSONObject jsonObject)
              throws JSONException
Constructs a JSONHashtable from a JSONObject. Recursively walks through the attributes of the JSONObject and adds the value at each leaf node into a Hashtable with a key that represents the path to that node. Some examples of keys are /person, /person/name, /person/friends/3/firstName.

Parameters:
jsonObject - The source of the data for the Hashtable.
Throws:
JSONException - If there is a problem accessing data in the JSONObject.
Since:
BlackBerry API 6.0.0

JSONHashtable

public JSONHashtable(JSONArray jsonArray)
              throws JSONException
Constructs a JSONHashtable from a JSONArray. Recursively walks through the entries in the JSONArray and adds the value at each leaf node into the Hashtable with a key that represents the path to that node. Some examples of keys are /0/person, /1/person/name, /2/person/friends/3/firstName.

Parameters:
jsonArray - The source of the data for the Hashtable.
Throws:
JSONException - If there is a problem accessing data in the JSONArray.
Since:
BlackBerry API 6.0.0





Copyright 1999-2010 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.