|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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
.
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 |
---|
int getNumKeys(String key)
key
- Path to search.
int getNumValues(String key)
key
- Path to search.
String getStringAt(String key, int index, String defaultValue)
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.
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
.
defaultValue
if no value is available.String getString(String key, String defaultValue)
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.
key
- Path to an element in document.defaultValue
- Value to return if no value is found for the key in the Hashtable
.
defaultValue
if no value is available.String getStringAt(String key, int index)
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.
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.
null
if no value is available.String getString(String key)
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.
key
- Path to an element in document.
null
if no value is available.String[] getStringArray(String key)
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:
Vector
: will be converted to a String
array.
String
: will return an array with a single entry.
String
object: a single element array with the output of the object's toString
method.
If the key is not found, then null
is returned.
key
- Path to an element in the document.
String
values corresponding to this key, or null
if no value is available.boolean getBooleanAt(String key, int index, boolean defaultValue)
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
.
defaultValue
if no value is available.boolean getBoolean(String key, boolean defaultValue)
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
.
defaultValue
if no value is available.boolean getBooleanAt(String key, int index)
false
is returned.
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.
false
if no value is available.boolean getBoolean(String key)
false
is returned.
key
- Path to an element in the document.
false
if no value is available.boolean[] getBooleanArray(String key)
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:
Vector
: will be converted to a boolean
array.
boolean
: will return an array with a single entry.
String
object: a single element array with the output
of Boolean.pasrseBoolean
; the output of the object's
toString
method is passed to parseBoolean
.
If the key is not found, then null
is returned.
key
- Path to an element in the document.
boolean
values corresponding to this key, or null
if no value is available.int getIntegerAt(String key, int index, int defaultValue, int radix)
int
value that corresponds to a given key. If there
is no value at the key specified, the default value is returned.
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
.
defaultValue
if no value is available.
NumberFormatException
- If a value is present but it cannot be parsed into an int
.int getInteger(String key, int defaultValue, int radix)
int
value that corresponds to a given key. If there
is no value at the key specified, the default value is returned.
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
.
defaultValue
if no value is available.
NumberFormatException
- If a value is present but it cannot be parsed into an int
.int getIntegerAt(String key, int index, int defaultValue)
int
value that corresponds to a given key. If there
is no value at the key specified, the default value is returned.
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
.
defaultValue
if no value is available.
NumberFormatException
- If a value is present but it cannot be parsed into an int
.int getInteger(String key, int defaultValue)
int
value that corresponds to a given key. If there
is no value at the key specified, the default value is returned.
key
- Path to an element in the document.defaultValue
- Value to return if no value is found for the key in the Hashtable
.
defaultValue
if no value is available.
NumberFormatException
- If a value is present but it cannot be parsed into an int
.int getIntegerAt(String key, int index)
int
value that corresponds to a given key. If there
is no value at the key specified, the default value is returned.
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.
0
if no value is available.
NumberFormatException
- If a value is present but it cannot be parsed into an int
.int getInteger(String key)
int
value that corresponds to a given key. If there
is no value at the key specified, the default value is returned.
key
- Path to an element in the document.
0
if no value is available.
NumberFormatException
- If a value is present but it cannot be parsed into an int
.int[] getIntegerArray(String key)
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:
Vector
: will be converted to an int
array.
int
: will return an array with a single entry.
String
object: a single element array with the output
of Integer.parseInt
; the output of the object's
toString
method is passed to parseInt
.
If the key is not found, then null
is returned.
key
- Path to an element in the document.
int
values corresponding to this key, or null
if no value is available.double getDoubleAt(String key, int index, double defaultValue)
double
value that corresponds to a given key. If there
is no value at the key specified, the default value is returned.
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
.
defaultValue
if no value is available.
NumberFormatException
- If a value is present but it cannot be parsed into a double
.double getDouble(String key, double defaultValue)
double
value that corresponds to a given key. If there
is no value at the key specified, the default value is returned.
key
- Path to an element in the document.defaultValue
- Value to return if no value is found for the key in the Hashtable
.
defaultValue
if no value is available.
NumberFormatException
- If a value is present but it cannot be parsed into a double
.double getDoubleAt(String key, int index)
double
value that corresponds to a given key. If there
is no value at the key specified, the default value is returned.
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.
NumberFormatException
- If a value is present but it cannot be parsed into a double
.double getDouble(String key)
double
value that corresponds to a given key. If there
is no value at the key specified, the default value is returned.
key
- Path to an element in the document.
NumberFormatException
- If a value is present but it cannot be parsed into a double
.double[] getDoubleArray(String key)
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:
Vector
: will be converted to a double
array.
double
: will return an array with a single entry.
String
object: a single element array with the output
of Double.parseDouble
; the output of the object's
toString
method is passed to parseDouble
.
If the key is not found, then null
is returned.
key
- Path to an element in the document.
double
values corresponding to this key, or null
if no value is available.float getFloatAt(String key, int index, float defaultValue)
float
value that corresponds to a given key. If there
is no value at the key specified, the default value is returned.
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
.
defaultValue
if no value is available.
NumberFormatException
- If a value is present but it cannot be parsed into a float
.float getFloat(String key, float defaultValue)
float
value that corresponds to a given key. If there
is no value at the key specified, the default value is returned.
key
- Path to an element in the document.defaultValue
- Value to return if no value is found for the key in the Hashtable
.
defaultValue
if no value is available.
NumberFormatException
- If a value is present but it cannot be parsed into an float
.float getFloatAt(String key, int index)
float
value that corresponds to a given key. If there
is no value at the key specified, the default value is returned.
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.
NumberFormatException
- If a value is present but it cannot be parsed into a float
.float getFloat(String key)
float
value that corresponds to a given key. If there
is no value at the key specified, the default value is returned.
key
- Path to an element in the document.
NumberFormatException
- If a value is present but it cannot be parsed into a float
.float[] getFloatArray(String key)
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:
Vector
: will be converted to a float
array.
float
: will return an array with a single entry.
String
object: a single element array with the output
of Float.parseFloat
; the output of the object's
toString
method is passed to parseFloat
.
If the key is not found, then null
is returned.
key
- Path to an element in the document.
float
values corresponding to this key, or null
if no value is available.short getShortAt(String key, int index, short defaultValue)
short
value that corresponds to a given key. If there
is no value at the key specified, the default value is returned.
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
.
defaultValue
if no value is available.
NumberFormatException
- If a value is present but it cannot be parsed into a short
.short getShort(String key, short defaultValue)
short
value that corresponds to a given key. If there
is no value at the key specified, the default value is returned.
key
- Path to an element in the document.defaultValue
- Value to return if no value is found for the key in the Hashtable
.
defaultValue
if no value is available.
NumberFormatException
- If a value is present but it cannot be parsed into a short
.short getShortAt(String key, int index)
float
value that corresponds to a given key. If there
is no value at the key specified, the default value is returned.
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.
NumberFormatException
- If a value is present but it cannot be parsed into a short
.short getShort(String key)
short
value that corresponds to a given key. If there
is no value at the key specified, the default value is returned.
key
- Path to an element in the document.
NumberFormatException
- If a value is present but it cannot be parsed into a short
.short[] getShortArray(String key)
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:
Vector
: will be converted to a short
array.
short
: will return an array with a single entry.
String
object: a single element array with the output
of Short.parseShort
; the output of the object's
toString
method is passed to parseShort
.
If the key is not found, then null
is returned.
key
- Path to an element in the document.
short
values corresponding to this key, or null
if no value is available.long getLongAt(String key, int index, long defaultValue)
long
value that corresponds to a given key. If there
is no value at the key specified, the default value is returned.
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
.
defaultValue
if no value is available.
NumberFormatException
- If a value is present but it cannot be parsed into a long
.long getLong(String key, long defaultValue)
long
value that corresponds to a given key. If there
is no value at the key specified, the default value is returned.
key
- Path to an element in the document.defaultValue
- Value to return if no value is found for the key in the Hashtable
.
defaultValue
if no value is available.
NumberFormatException
- If a value is present but it cannot be parsed into a long
.long getLongAt(String key, int index)
long
value that corresponds to a given key. If there
is no value at the key specified, the default value is returned.
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.
NumberFormatException
- If a value is present but it cannot be parsed into a long
.long getLong(String key)
long
value that corresponds to a given key. If there
is no value at the key specified, the default value is returned.
key
- Path to an element in the document.
NumberFormatException
- If a value is present but it cannot be parsed into a long
.long[] getLongArray(String key)
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:
Vector
: will be converted to a long
array.
long
: will return an array with a single entry.
String
object: a single element array with the output
of Long.parseLong
; the output of the object's
toString
method is passed to parseLong
.
If the key is not found, then null
is returned.
key
- Path to an element in the document.
long
values corresponding to this key, or null
if no value is available.byte getByteAt(String key, int index, byte defaultValue)
byte
value that corresponds to a given key. If there
is no value at the key specified, the default value is returned.
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
.
defaultValue
if no value is available.
NumberFormatException
- If a value is present but it cannot be parsed into a byte
.byte getByte(String key, byte defaultValue)
byte
value that corresponds to a given key. If there
is no value at the key specified, the default value is returned.
key
- Path to an element in the document.defaultValue
- Value to return if no value is found for the key in the Hashtable
.
defaultValue
if no value is available.
NumberFormatException
- If a value is present but it cannot be parsed into a byte
.byte getByteAt(String key, int index)
byte
value that corresponds to a given key. If there
is no value at the key specified, the default value is returned.
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.
NumberFormatException
- If a value is present but it cannot be parsed into a byte
.byte getByte(String key)
byte
value that corresponds to a given key. If there
is no value at the key specified, the default value is returned.
key
- Path to an element in the document.
NumberFormatException
- If a value is present but it cannot be parsed into a byte
.byte[] getByteArray(String key)
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:
Vector
: will be converted to a byte
array.
byte
: will return an array with a single entry.
String
object: a single element array with the output
of Byte.parseByte
; the output of the object's
toString
method is passed to parseByte
.
If the key is not found, then null
is returned.
key
- Path to an element in the document.
byte
values corresponding to this key, or null
if no value is available.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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.