net.rim.device.api.io.parser
Interface ObjectPathHashtable

All Known Implementing Classes:
ObjectPathHashtableBase, JSONHashtable, XMLHashtable

public interface ObjectPathHashtable

Defines extra methods that can be used to access both XMLHashtable objects and JSONHashtable objects. This includes additional type conversion and key building convenience methods beyond those available in Hashtable.

Since:
BlackBerry API 6.0.0

Method Summary
 boolean getBoolean(String key)
          Indicates whether the value associated with a key is equal to the string "true".
 boolean getBoolean(String key, boolean defaultValue)
          Indicates whether the value associated with a key is equal to the string "true".
 boolean[] getBooleanArray(String key)
          Returns an array of boolean values associated with the key specified.
 boolean getBooleanAt(String key, int index)
          Indicates whether the value associated with a key is equal to the string "true".
 boolean getBooleanAt(String key, int index, boolean defaultValue)
          Indicates whether the value associated with a key is equal to the string "true".
 byte getByte(String key)
          Returns a byte value that corresponds to a given key.
 byte getByte(String key, byte defaultValue)
          Returns an byte value that corresponds to a given key.
 byte[] getByteArray(String key)
          Returns an array of byte values associated with the key specified.
 byte getByteAt(String key, int index)
          Returns a byte value that corresponds to a given key.
 byte getByteAt(String key, int index, byte defaultValue)
          Returns a byte value that corresponds to a given key.
 double getDouble(String key)
          Returns a double value that corresponds to a given key.
 double getDouble(String key, double defaultValue)
          Returns a double value that corresponds to a given key.
 double[] getDoubleArray(String key)
          Returns an array of double values associated with the key specified.
 double getDoubleAt(String key, int index)
          Returns a double value that corresponds to a given key.
 double getDoubleAt(String key, int index, double defaultValue)
          Returns a double value that corresponds to a given key.
 float getFloat(String key)
          Returns a float value that corresponds to a given key.
 float getFloat(String key, float defaultValue)
          Returns an float value that corresponds to a given key.
 float[] getFloatArray(String key)
          Returns an array of float values associated with the key specified.
 float getFloatAt(String key, int index)
          Returns a float value that corresponds to a given key.
 float getFloatAt(String key, int index, float defaultValue)
          Returns a float value that corresponds to a given key.
 int getInteger(String key)
          Returns an int value that corresponds to a given key.
 int getInteger(String key, int defaultValue)
          Returns an int value that corresponds to a given key.
 int getInteger(String key, int defaultValue, int radix)
          Returns an int value that corresponds to a given key.
 int[] getIntegerArray(String key)
          Returns an array of int values associated with the key specified.
 int getIntegerAt(String key, int index)
          Returns an int value that corresponds to a given key.
 int getIntegerAt(String key, int index, int defaultValue)
          Returns an int value that corresponds to a given key.
 int getIntegerAt(String key, int index, int defaultValue, int radix)
          Returns an int value that corresponds to a given key.
 long getLong(String key)
          Returns a long value that corresponds to a given key.
 long getLong(String key, long defaultValue)
          Returns a long value that corresponds to a given key.
 long[] getLongArray(String key)
          Returns an array of long values associated with the key specified.
 long getLongAt(String key, int index)
          Returns a long value that corresponds to a given key.
 long getLongAt(String key, int index, long defaultValue)
          Returns a long value that corresponds to a given key.
 int getNumKeys(String key)
          Returns the number of individual keys for a given path.
 int getNumValues(String key)
          Returns the number of values available under a specified key.
 short getShort(String key)
          Returns a short value that corresponds to a given key.
 short getShort(String key, short defaultValue)
          Returns a short value that corresponds to a given key.
 short[] getShortArray(String key)
          Returns an array of short values associated with the key specified.
 short getShortAt(String key, int index)
          Returns a float value that corresponds to a given key.
 short getShortAt(String key, int index, short defaultValue)
          Returns a short value that corresponds to a given key.
 String getString(String key)
          Returns the String value associated with a key.
 String getString(String key, String defaultValue)
          Returns the String value associated with a key.
 String[] getStringArray(String key)
          Returns an array of String values associated with the key specified.
 String getStringAt(String key, int index)
          Returns the String value associated with a key.
 String getStringAt(String key, int index, String defaultValue)
          Returns the String value associated with the key at a given index.
 



Method Detail

getNumKeys

int getNumKeys(String key)
Returns the number of individual keys for a given path.

Parameters:
key - Path to search.
Returns:
Number of occurrences of this path in the document that was parsed.
Since:
BlackBerry API 6.0.0

getNumValues

int getNumValues(String key)
Returns the number of values available under a specified key.

Parameters:
key - Path to search.
Returns:
Number of values available under this key.
Since:
BlackBerry API 6.0.0

getStringAt

String getStringAt(String key,
                   int index,
                   String defaultValue)
Returns the String value associated with the key at a given index. If there is more than one value associated with the key, then the first one is returned. If the key is not found, then the default value is returned.

Parameters:
key - Path to an element in the document.
index - Zero-based index into an array. A value of 0 should be used if not querying an array.
defaultValue - Value to return if no value is found for the key in the Hashtable.
Returns:
The value corresponding to this key, or defaultValue if no value is available.
Since:
BlackBerry API 6.0.0

getString

String getString(String key,
                 String defaultValue)
Returns the String value associated with a key. If there is more than one value associated with the key, then the first one is returned. If the key is not found, then the defaultValue is returned.

Parameters:
key - Path to an element in document.
defaultValue - Value to return if no value is found for the key in the Hashtable.
Returns:
The value corresponding to this key, or defaultValue if no value is available.
Since:
BlackBerry API 6.0.0

getStringAt

String getStringAt(String key,
                   int index)
Returns the String value associated with a key. If there is more than one value associated with the key, then the first one is returned. If the key is not found, then the defaultValue is returned.

Parameters:
key - Path to an element in document.
index - Zero-based index into an array. A value of 0 should be used if not querying an array.
Returns:
The value corresponding to this key, or null if no value is available.
Since:
BlackBerry API 6.0.0

getString

String getString(String key)
Returns the String value associated with a key. If there is more than one value associated with the key, then the first one is returned. If the key is not found, then the defaultValue is returned.

Parameters:
key - Path to an element in document.
Returns:
The value corresponding to this key, or null if no value is available.
Since:
BlackBerry API 6.0.0

getStringArray

String[] getStringArray(String key)
Returns an array of String values associated with the key specified. getStringArray will do the following if it encounters something other than a String array for the key specified:

If the key is not found, then null is returned.

Parameters:
key - Path to an element in the document.
Returns:
An array of String values corresponding to this key, or null if no value is available.
Since:
BlackBerry API 6.0.0

getBooleanAt

boolean getBooleanAt(String key,
                     int index,
                     boolean defaultValue)
Indicates whether the value associated with a key is equal to the string "true". The value is trimmed and a case-insensitive comparison is performed.

The default value is returned as a result of any of the following conditions:

Parameters:
key - Path to an element in the document.
index - Zero-based index into an array. A value of 0 should be used if not querying an array.
defaultValue - Value to return if no value is found for the key in the Hashtable.
Returns:
The value corresponding to this key, or defaultValue if no value is available.
Since:
BlackBerry API 6.0.0

getBoolean

boolean getBoolean(String key,
                   boolean defaultValue)
Indicates whether the value associated with a key is equal to the string "true". The value is trimmed and a case-insensitive comparison is performed.

The default value is returned as a result of any of the following conditions:

Parameters:
key - Path to an element in the document.
defaultValue - Value to return if no value is found for the key in the Hashtable.
Returns:
The value corresponding to this key, or defaultValue if no value is available.
Since:
BlackBerry API 6.0.0

getBooleanAt

boolean getBooleanAt(String key,
                     int index)
Indicates whether the value associated with a key is equal to the string "true". The value is trimmed and a case-insensitive comparison is performed.

The false value is returned as a result of any of the following conditions:

Parameters:
key - Path to an element in the document.
index - Zero-based index into an array. A value of 0 should be used if not querying an array.
Returns:
The value corresponding to this key, or false if no value is available.
Since:
BlackBerry API 6.0.0

getBoolean

boolean getBoolean(String key)
Indicates whether the value associated with a key is equal to the string "true". The value is trimmed and a case-insensitive comparison is performed.

The false value is returned as a result of any of the following conditions:

Parameters:
key - Path to an element in the document.
Returns:
The value corresponding to this key, or false if no value is available.
Since:
BlackBerry API 6.0.0

getBooleanArray

boolean[] getBooleanArray(String key)
Returns an array of boolean values associated with the key specified. getBooleanArray will do the following if it encounters something other than a boolean array for the key specified:

If the key is not found, then null is returned.

Parameters:
key - Path to an element in the document.
Returns:
An array of boolean values corresponding to this key, or null if no value is available.
Since:
BlackBerry API 6.0.0

getIntegerAt

int getIntegerAt(String key,
                 int index,
                 int defaultValue,
                 int radix)
Returns an int value that corresponds to a given key. If there is no value at the key specified, the default value is returned.

Parameters:
key - Path to an element in the document.
index - Zero-based index into an array. A value of 0 should be used if not querying an array.
defaultValue - Value to return if no value is found for the key in the Hashtable.
radix - Radix to use when converting from a String to an int.
Returns:
The value corresponding to the key, or defaultValue if no value is available.
Throws:
NumberFormatException - If a value is present but it cannot be parsed into an int.
Since:
BlackBerry API 6.0.0

getInteger

int getInteger(String key,
               int defaultValue,
               int radix)
Returns an int value that corresponds to a given key. If there is no value at the key specified, the default value is returned.

Parameters:
key - Path to an element in the document.
defaultValue - Value to return if no value is found for the key in the Hashtable.
radix - Radix to use when converting from a String to an int.
Returns:
The value corresponding to the key, or defaultValue if no value is available.
Throws:
NumberFormatException - If a value is present but it cannot be parsed into an int.
Since:
BlackBerry API 6.0.0

getIntegerAt

int getIntegerAt(String key,
                 int index,
                 int defaultValue)
Returns an int value that corresponds to a given key. If there is no value at the key specified, the default value is returned.

Parameters:
key - Path to an element in the document.
index - Zero-based index into an array. A value of 0 should be used if not querying an array.
defaultValue - Value to return if no value is found for the key in the Hashtable.
Returns:
The value corresponding to the key, or defaultValue if no value is available.
Throws:
NumberFormatException - If a value is present but it cannot be parsed into an int.
Since:
BlackBerry API 6.0.0

getInteger

int getInteger(String key,
               int defaultValue)
Returns an int value that corresponds to a given key. If there is no value at the key specified, the default value is returned.

Parameters:
key - Path to an element in the document.
defaultValue - Value to return if no value is found for the key in the Hashtable.
Returns:
The value corresponding to the key, or defaultValue if no value is available.
Throws:
NumberFormatException - If a value is present but it cannot be parsed into an int.
Since:
BlackBerry API 6.0.0

getIntegerAt

int getIntegerAt(String key,
                 int index)
Returns an int value that corresponds to a given key. If there is no value at the key specified, the default value is returned.

Parameters:
key - Path to an element in the document.
index - Zero-based index into an array. A value of 0 should be used if not querying an array.
Returns:
The value corresponding to the key, or 0 if no value is available.
Throws:
NumberFormatException - If a value is present but it cannot be parsed into an int.
Since:
BlackBerry API 6.0.0

getInteger

int getInteger(String key)
Returns an int value that corresponds to a given key. If there is no value at the key specified, the default value is returned.

Parameters:
key - Path to an element in the document.
Returns:
The value corresponding to the key, or 0 if no value is available.
Throws:
NumberFormatException - If a value is present but it cannot be parsed into an int.
Since:
BlackBerry API 6.0.0

getIntegerArray

int[] getIntegerArray(String key)
Returns an array of int values associated with the key specified. getIntegerArray will do the following if it encounters something other than an int array for the key specified:

If the key is not found, then null is returned.

Parameters:
key - Path to an element in the document.
Returns:
An array of int values corresponding to this key, or null if no value is available.
Since:
BlackBerry API 6.0.0

getDoubleAt

double getDoubleAt(String key,
                   int index,
                   double defaultValue)
Returns a double value that corresponds to a given key. If there is no value at the key specified, the default value is returned.

Parameters:
key - Path to an element in the document.
index - Zero-based index into an array. A value of 0 should be used if not querying an array.
defaultValue - Value to return if no value is found for the key in the Hashtable.
Returns:
The value corresponding to the key, or defaultValue if no value is available.
Throws:
NumberFormatException - If a value is present but it cannot be parsed into a double.
Since:
BlackBerry API 6.0.0

getDouble

double getDouble(String key,
                 double defaultValue)
Returns a double value that corresponds to a given key. If there is no value at the key specified, the default value is returned.

Parameters:
key - Path to an element in the document.
defaultValue - Value to return if no value is found for the key in the Hashtable.
Returns:
The value corresponding to the key, or defaultValue if no value is available.
Throws:
NumberFormatException - If a value is present but it cannot be parsed into a double.
Since:
BlackBerry API 6.0.0

getDoubleAt

double getDoubleAt(String key,
                   int index)
Returns a double value that corresponds to a given key. If there is no value at the key specified, the default value is returned.

Parameters:
key - Path to an element in the document.
index - Zero-based index into an array. A value of 0 should be used if not querying an array.
Returns:
The value corresponding to the key, or 0 if no value is available.
Throws:
NumberFormatException - If a value is present but it cannot be parsed into a double.
Since:
BlackBerry API 6.0.0

getDouble

double getDouble(String key)
Returns a double value that corresponds to a given key. If there is no value at the key specified, the default value is returned.

Parameters:
key - Path to an element in the document.
Returns:
The value corresponding to the key, or 0 if no value is available.
Throws:
NumberFormatException - If a value is present but it cannot be parsed into a double.
Since:
BlackBerry API 6.0.0

getDoubleArray

double[] getDoubleArray(String key)
Returns an array of double values associated with the key specified. getIntegerArray will do the following if it encounters something other than a double array for the key specified:

If the key is not found, then null is returned.

Parameters:
key - Path to an element in the document.
Returns:
An array of double values corresponding to this key, or null if no value is available.
Since:
BlackBerry API 6.0.0

getFloatAt

float getFloatAt(String key,
                 int index,
                 float defaultValue)
Returns a float value that corresponds to a given key. If there is no value at the key specified, the default value is returned.

Parameters:
key - Path to an element in the document.
index - Zero-based index into an array. A value of 0 should be used if not querying an array.
defaultValue - Value to return if no value is found for the key in the Hashtable.
Returns:
The value corresponding to the key, or defaultValue if no value is available.
Throws:
NumberFormatException - If a value is present but it cannot be parsed into a float.
Since:
BlackBerry API 6.0.0

getFloat

float getFloat(String key,
               float defaultValue)
Returns an float value that corresponds to a given key. If there is no value at the key specified, the default value is returned.

Parameters:
key - Path to an element in the document.
defaultValue - Value to return if no value is found for the key in the Hashtable.
Returns:
The value corresponding to the key, or defaultValue if no value is available.
Throws:
NumberFormatException - If a value is present but it cannot be parsed into an float.
Since:
BlackBerry API 6.0.0

getFloatAt

float getFloatAt(String key,
                 int index)
Returns a float value that corresponds to a given key. If there is no value at the key specified, the default value is returned.

Parameters:
key - Path to an element in the document.
index - Zero-based index into an array. A value of 0 should be used if not querying an array.
Returns:
The value corresponding to the key, or 0 if no value is available.
Throws:
NumberFormatException - If a value is present but it cannot be parsed into a float.
Since:
BlackBerry API 6.0.0

getFloat

float getFloat(String key)
Returns a float value that corresponds to a given key. If there is no value at the key specified, the default value is returned.

Parameters:
key - Path to an element in the document.
Returns:
The value corresponding to the key, or 0 if no value is available.
Throws:
NumberFormatException - If a value is present but it cannot be parsed into a float.
Since:
BlackBerry API 6.0.0

getFloatArray

float[] getFloatArray(String key)
Returns an array of float values associated with the key specified. getIntegerArray will do the following if it encounters something other than a float array for the key specified:

If the key is not found, then null is returned.

Parameters:
key - Path to an element in the document.
Returns:
An array of float values corresponding to this key, or null if no value is available.
Since:
BlackBerry API 6.0.0

getShortAt

short getShortAt(String key,
                 int index,
                 short defaultValue)
Returns a short value that corresponds to a given key. If there is no value at the key specified, the default value is returned.

Parameters:
key - Path to an element in the document.
index - Zero-based index into an array. A value of 0 should be used if not querying an array.
defaultValue - Value to return if no value is found for the key in the Hashtable.
Returns:
The value corresponding to the key, or defaultValue if no value is available.
Throws:
NumberFormatException - If a value is present but it cannot be parsed into a short.
Since:
BlackBerry API 6.0.0

getShort

short getShort(String key,
               short defaultValue)
Returns a short value that corresponds to a given key. If there is no value at the key specified, the default value is returned.

Parameters:
key - Path to an element in the document.
defaultValue - Value to return if no value is found for the key in the Hashtable.
Returns:
The value corresponding to the key, or defaultValue if no value is available.
Throws:
NumberFormatException - If a value is present but it cannot be parsed into a short.
Since:
BlackBerry API 6.0.0

getShortAt

short getShortAt(String key,
                 int index)
Returns a float value that corresponds to a given key. If there is no value at the key specified, the default value is returned.

Parameters:
key - Path to an element in the document.
index - Zero-based index into an array. A value of 0 should be used if not querying an array.
Returns:
The value corresponding to the key, or 0 if no value is available.
Throws:
NumberFormatException - If a value is present but it cannot be parsed into a short.
Since:
BlackBerry API 6.0.0

getShort

short getShort(String key)
Returns a short value that corresponds to a given key. If there is no value at the key specified, the default value is returned.

Parameters:
key - Path to an element in the document.
Returns:
The value corresponding to the key, or 0 if no value is available.
Throws:
NumberFormatException - If a value is present but it cannot be parsed into a short.
Since:
BlackBerry API 6.0.0

getShortArray

short[] getShortArray(String key)
Returns an array of short values associated with the key specified. getIntegerArray will do the following if it encounters something other than a short array for the key specified:

If the key is not found, then null is returned.

Parameters:
key - Path to an element in the document.
Returns:
An array of short values corresponding to this key, or null if no value is available.
Since:
BlackBerry API 6.0.0

getLongAt

long getLongAt(String key,
               int index,
               long defaultValue)
Returns a long value that corresponds to a given key. If there is no value at the key specified, the default value is returned.

Parameters:
key - Path to an element in the document.
index - Zero-based index into an array. A value of 0 should be used if not querying an array.
defaultValue - Value to return if no value is found for the key in the Hashtable.
Returns:
The value corresponding to the key, or defaultValue if no value is available.
Throws:
NumberFormatException - If a value is present but it cannot be parsed into a long.
Since:
BlackBerry API 6.0.0

getLong

long getLong(String key,
             long defaultValue)
Returns a long value that corresponds to a given key. If there is no value at the key specified, the default value is returned.

Parameters:
key - Path to an element in the document.
defaultValue - Value to return if no value is found for the key in the Hashtable.
Returns:
The value corresponding to the key, or defaultValue if no value is available.
Throws:
NumberFormatException - If a value is present but it cannot be parsed into a long.
Since:
BlackBerry API 6.0.0

getLongAt

long getLongAt(String key,
               int index)
Returns a long value that corresponds to a given key. If there is no value at the key specified, the default value is returned.

Parameters:
key - Path to an element in the document.
index - Zero-based index into an array. A value of 0 should be used if not querying an array.
Returns:
The value corresponding to the key, or 0 if no value is available.
Throws:
NumberFormatException - If a value is present but it cannot be parsed into a long.
Since:
BlackBerry API 6.0.0

getLong

long getLong(String key)
Returns a long value that corresponds to a given key. If there is no value at the key specified, the default value is returned.

Parameters:
key - Path to an element in the document.
Returns:
The value corresponding to the key, or 0 if no value is available.
Throws:
NumberFormatException - If a value is present but it cannot be parsed into a long.
Since:
BlackBerry API 6.0.0

getLongArray

long[] getLongArray(String key)
Returns an array of long values associated with the key specified. getIntegerArray will do the following if it encounters something other than a long array for the key specified:

If the key is not found, then null is returned.

Parameters:
key - Path to an element in the document.
Returns:
An array of long values corresponding to this key, or null if no value is available.
Since:
BlackBerry API 6.0.0

getByteAt

byte getByteAt(String key,
               int index,
               byte defaultValue)
Returns a byte value that corresponds to a given key. If there is no value at the key specified, the default value is returned.

Parameters:
key - Path to an element in the document.
index - Zero-based index into an array. A value of 0 should be used if not querying an array.
defaultValue - Value to return if no value is found for the key in the Hashtable.
Returns:
The value corresponding to the key, or defaultValue if no value is available.
Throws:
NumberFormatException - If a value is present but it cannot be parsed into a byte.
Since:
BlackBerry API 6.0.0

getByte

byte getByte(String key,
             byte defaultValue)
Returns an byte value that corresponds to a given key. If there is no value at the key specified, the default value is returned.

Parameters:
key - Path to an element in the document.
defaultValue - Value to return if no value is found for the key in the Hashtable.
Returns:
The value corresponding to the key, or defaultValue if no value is available.
Throws:
NumberFormatException - If a value is present but it cannot be parsed into a byte.
Since:
BlackBerry API 6.0.0

getByteAt

byte getByteAt(String key,
               int index)
Returns a byte value that corresponds to a given key. If there is no value at the key specified, the default value is returned.

Parameters:
key - Path to an element in the document.
index - Zero-based index into an array. A value of 0 should be used if not querying an array.
Returns:
The value corresponding to the key, or 0 if no value is available.
Throws:
NumberFormatException - If a value is present but it cannot be parsed into a byte.
Since:
BlackBerry API 6.0.0

getByte

byte getByte(String key)
Returns a byte value that corresponds to a given key. If there is no value at the key specified, the default value is returned.

Parameters:
key - Path to an element in the document.
Returns:
The value corresponding to the key, or 0 if no value is available.
Throws:
NumberFormatException - If a value is present but it cannot be parsed into a byte.
Since:
BlackBerry API 6.0.0

getByteArray

byte[] getByteArray(String key)
Returns an array of byte values associated with the key specified. getIntegerArray will do the following if it encounters something other than a byte array for the key specified:

If the key is not found, then null is returned.

Parameters:
key - Path to an element in the document.
Returns:
An array of byte values corresponding to this key, or null if no value is available.
Since:
BlackBerry API 6.0.0





Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal