public class TypedMap
extends java.lang.Object
java.util.Map
object.
It provides additional methods for retrieving properties such as java.lang.Integer
,
java.lang.Double
, java.lang.Float
& java.lang.String
instead of java.lang.Object
.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COPYRIGHT
The IBM Copyright notice field.
|
Constructor and Description |
---|
TypedMap(java.util.Map argMap)
This constructor creates a typed property object from the given hashtable.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
get(java.lang.String key)
This method returns the
Object associated with the specified key. |
java.lang.Object |
get(java.lang.String key,
java.lang.Object def)
This method returns the
Object associated with the specified key. |
java.lang.String[] |
getArray(java.lang.String key)
This method returns the object associated with the given key as an array of
String objects. |
java.lang.String[] |
getArray(java.lang.String key,
java.lang.String[] def)
This method returns the object associated with the given key as an array of
String objects. |
java.math.BigDecimal |
getBigDecimal(java.lang.String key)
This method returns the object associated with the given key as a
BigDecimal object. |
java.math.BigDecimal |
getBigDecimal(java.lang.String key,
java.math.BigDecimal def)
This method returns the object associated with the given key as a
BigDecimal object. |
boolean |
getBoolean(java.lang.String key)
This method returns the object associated with the given key as a boolean value.
|
boolean |
getBoolean(java.lang.String key,
boolean def)
This method returns the object associated with the given key as a boolean value.
|
java.lang.Double |
getDouble(java.lang.String key)
This method returns the object associated with the given key as a
Double object. |
java.lang.Double |
getDouble(java.lang.String key,
double def)
This method returns the object associated with the given key as a
Double object. |
java.lang.Double |
getDouble(java.lang.String key,
java.lang.Double def)
This method returns the object associated with the given key as a
Double object. |
double |
getDoubleValue(java.lang.String key)
This method returns the object associated with the given key as a
double value. |
double |
getDoubleValue(java.lang.String key,
double def)
This method returns the object associated with the given key as a
double value. |
java.lang.Float |
getFloat(java.lang.String key)
This method returns the object associated with the given key as a
Float object. |
java.lang.Float |
getFloat(java.lang.String key,
float def)
This method returns the object associated with the given key as a
Float object. |
java.lang.Float |
getFloat(java.lang.String key,
java.lang.Float def)
This method returns the object associated with the given key as a
Float object. |
float |
getFloatValue(java.lang.String key)
This method returns the object associated with the given key as a
float value. |
float |
getFloatValue(java.lang.String key,
float def)
This method returns the value associated with the given key as a
float value. |
java.lang.Integer |
getInteger(java.lang.String key)
This method returns the object associated with the given key as an
Integer object. |
java.lang.Integer |
getInteger(java.lang.String key,
int def)
This method returns the object associated with the given key as an
Integer object. |
java.lang.Integer |
getInteger(java.lang.String key,
java.lang.Integer def)
This method returns the object associated with the given key as an
Integer object. |
int |
getIntValue(java.lang.String key)
This method returns the object associated with the given key as an
integer value. |
int |
getIntValue(java.lang.String key,
int def)
This method returns the object associated with the given key as an
integer value. |
java.lang.Long |
getLong(java.lang.String key)
This method returns the object associated with the given key as a
Long object. |
java.lang.Long |
getLong(java.lang.String key,
long def)
This method returns the object associated with the given key as a
Long object. |
java.lang.Long |
getLong(java.lang.String key,
java.lang.Long def)
This method returns the object associated with the given key as a
Long object. |
java.lang.Long[] |
getLongArray(java.lang.String key)
This method returns the object associated with the given key as an array of
Long objects. |
java.lang.Long[] |
getLongArray(java.lang.String key,
java.lang.Long[] def)
This method returns the object associated with the given key as an array of
Long objects. |
long |
getLongValue(java.lang.String key)
This method returns the object associated with the given key as a
long value. |
long |
getLongValue(java.lang.String key,
long def)
This method returns the object associated with the given key as a
long value. |
java.util.Map |
getMap() |
java.lang.Short |
getShort(java.lang.String key)
This method returns the object associated with the given key as a
Short object. |
java.lang.Short |
getShort(java.lang.String key,
short def)
This method returns the object associated with the given key as a
Short object. |
java.lang.Short |
getShort(java.lang.String key,
java.lang.Short def)
This method returns the object associated with the given key as a
Short object. |
short |
getShortValue(java.lang.String key)
This method returns the object associated with the given key as a
short value. |
short |
getShortValue(java.lang.String key,
short def)
This method returns the object associated with the given key as a
short value.. |
java.lang.String |
getString(java.lang.String key)
This method returns the value associated with the key as a
String object. |
java.lang.String |
getString(java.lang.String key,
java.lang.String def)
This method returns the object associated with the key as a
String object. |
static java.lang.String[] |
objectToArrayOfString(java.lang.Object aObject,
java.lang.String[] def)
This method converts a
TypedProperty object to an array of String objects. |
static java.lang.String |
objectToString(java.lang.Object aObject,
java.lang.String def)
This method converts a
TypedProperty object to a String object. |
void |
setMap(java.util.Map argMap) |
public static final java.lang.String COPYRIGHT
public TypedMap(java.util.Map argMap)
argMap
- The hashtable to base the typed property object on.public java.lang.Object get(java.lang.String key) throws OrderException
Object
associated with the specified key.key
- The key of the parameter to find.Object
associated with the specified key.com.ibm.commerce.exception.OrderException
- Thrown if the parameter does not exist
in the TypedProperty
object.OrderException
public java.lang.Object get(java.lang.String key, java.lang.Object def)
Object
associated with the specified key. If the object does not exist,
the default object is returned.key
- The key of the parameter to find.def
- The default object associated with the parameter.Object
corresponding to the key specified, or the default object if the key cannot be found.public static java.lang.String[] objectToArrayOfString(java.lang.Object aObject, java.lang.String[] def)
TypedProperty
object to an array of String
objects.
If the object is null, a specified default object is returned.
If the object is not an array, an array with a single element (the original object) is returned.
If the object is an array, an array with the same number of elements is returned. Each element
is either null, or the element converted to a String.aObject
- The object to be converted.def
- The default object.String
objects.public java.lang.String[] getArray(java.lang.String key) throws OrderException, OrderException
String
objects.
If the object is null, a OrderException
is thrown.
If the object is an array of String
objects, it is returned.
If the object is an array, a new String
array is created, and each non-null element of the object is
converted to a String
object by calling its toString()
method.
Otherwise, a new array of String
objects is created with one element, whose value is the result of calling the
object's toString()
method.key
- The key of the parameter to find.String
objects.com.ibm.commerce.exception.OrderException
- This is never thrown in this implementation.com.ibm.commerce.exception.OrderException
- Thrown if the parameter is not found in the TypedProperty
object.OrderException
public java.lang.String[] getArray(java.lang.String key, java.lang.String[] def)
String
objects.
If the object is null, the specified default object is returned.
If the object is an array of String
objects, it is returned.
If the object is an array of type Object
, a new String
array is created, and each non-null element of the object is
converted to a String
object by calling its toString()
method.
Otherwise, a new array of String
objects is created with one element, whose value is the result of calling the
object's toString()
method.key
- The key of the parameter to find.def
- the default value.String
objects.public java.math.BigDecimal getBigDecimal(java.lang.String key) throws OrderException
BigDecimal
object.key
- The key associated with the parameter to find.BigDecimal
object.OrderException
- Thrown if the object cannot be converted to a BigDecimal
object
or thrown if the specified parameter does not exist.public java.math.BigDecimal getBigDecimal(java.lang.String key, java.math.BigDecimal def) throws OrderException
BigDecimal
object.key
- The key of the parameter to find.def
- The default value associated with the parameter.BigDecimal
object. If the value cannot be found or converted
into a BigDecimal
object, the default value specified is returned.com.ibm.commerce.exception.OrderException
- Thrown if the object cannot be converted to a BigDecimal
object.OrderException
public boolean getBoolean(java.lang.String key) throws OrderException
key
- The key of the parameter to find.com.ibm.commerce.exception.OrderException
- Thrown if the parameter specified cannot be found.OrderException
public boolean getBoolean(java.lang.String key, boolean def)
key
- The key of the parameter to find.def
- The default value associated with the parameter.public java.lang.Double getDouble(java.lang.String key) throws OrderException
Double
object.key
- The key of the parameter to find.Double
object.com.ibm.commerce.exception.OrderException
- Thrown if the value cannot be converted to a Double
object.OrderException
public java.lang.Double getDouble(java.lang.String key, double def) throws OrderException
Double
object.key
- The key of the parameter to find.def
- The default object associated with the parameter.Double
object. If the parameter cannot be found or converted to a
Double
object, the default object is returned.com.ibm.commerce.exception.OrderException
- Thrown if the value cannot be converted to a Double
object.OrderException
public java.lang.Double getDouble(java.lang.String key, java.lang.Double def) throws OrderException
Double
object.key
- The key of the parameter to find.def
- The default object associated with the parameter.Double
object. If the parameter cannot be found or converted to a
Double
object, the default object is returned.com.ibm.commerce.exception.OrderException
- Thrown if the value cannot be converted to a Double
object.OrderException
public double getDoubleValue(java.lang.String key) throws OrderException
double
value.key
- The key of the parameter to find.double
value.com.ibm.commerce.exception.OrderException
- Thrown if the parameter cannot be found.OrderException
public double getDoubleValue(java.lang.String key, double def) throws OrderException
double
value.key
- The key of the parameter to find.def
- The default value associated with the parameter.double
value. If the object cannot be found or converted, the default
value specified is returned.com.ibm.commerce.exception.OrderException
- Thrown if the parameter cannot be found or if the object cannot be converted to a Double
object.OrderException
public java.lang.Float getFloat(java.lang.String key) throws OrderException
Float
object.key
- The key of the parameter to find.Float
object.com.ibm.commerce.exception.OrderException
- Thrown if the object cannot be converted to a Float
object.
or thrown if the parameter cannot be found.OrderException
public java.lang.Float getFloat(java.lang.String key, float def) throws OrderException
Float
object.key
- The key of the parameter to find.def
- The default object associated with the parameter.Float
, the default
object specified is returned.com.ibm.commerce.exception.OrderException
- Thrown if the object cannot be converted to a Float
object.OrderException
public java.lang.Float getFloat(java.lang.String key, java.lang.Float def) throws OrderException
Float
object.key
- The key of the parameter to find.def
- The default object associated with the parameter.Float
object. If the value cannot be found or converted to a Float
object, the default
object specified is returned.com.ibm.commerce.exception.OrderException
- Thrown if the object cannot be converted to a Float
object.OrderException
public float getFloatValue(java.lang.String key) throws OrderException
float
value.key
- The key of the parameter to find.float
value.com.ibm.commerce.exception.OrderException
- Thrown if the value cannot be converted in to float
or thrown if the parameter cannot be found.OrderException
public float getFloatValue(java.lang.String key, float def) throws OrderException
float
value.key
- The key of the parameter to find.def
- The default value associated with the parameter.float
value. If the object cannot be found or converted to a float, the default
value specified is returned.com.ibm.commerce.exception.OrderException
- Thrown if the object cannot be converted to a Float
object.OrderException
public java.lang.Integer getInteger(java.lang.String key) throws OrderException
Integer
object.key
- The key of the parameter to find.Integer
object.com.ibm.commerce.exception.OrderException
- Thrown if the value cannot be converted to an Integer object
or thrown if the parameter cannot be found.OrderException
public java.lang.Integer getInteger(java.lang.String key, int def) throws OrderException
Integer
object.key
- The key of the parameter to find.def
- The default object associated with the parameter.Integer
object. If the object cannot be found or converted to an Integer
object, the default
object specified is returned.com.ibm.commerce.exception.OrderException
- Thrown if the value cannot be converted to an Integer object.OrderException
public java.lang.Integer getInteger(java.lang.String key, java.lang.Integer def) throws OrderException
Integer
object.key
- The key of the parameter to find.def
- The default object associated with the parameter.Integer
object. If the object cannot be found or converted to an Integer
object, the default
object specified is returned.com.ibm.commerce.exception.OrderException
- Thrown if the value cannot be converted to an Integer object.OrderException
public int getIntValue(java.lang.String key) throws OrderException
integer
value.key
- The key of the parameter to find.integer
value.com.ibm.commerce.exception.OrderException
- Thrown if the object cannot be converted to an integer
value
or thrown if the parameter cannot be found.OrderException
public int getIntValue(java.lang.String key, int def) throws OrderException
integer
value.key
- The key of the parameter to find.def
- The default value associated with the parameter.integer
value. If the object cannot be found or converted to an integer, the default
value is returned.com.ibm.commerce.exception.OrderException
- Thrown if the object cannot be converted to an integer
value.OrderException
public java.lang.Long getLong(java.lang.String key) throws OrderException
Long
object.key
- The key of the parameter to find.Long
object.com.ibm.commerce.exception.OrderException
- Thrown if the value cannot be converted in to a Long object
or thrown if the parameter cannot be found.OrderException
public java.lang.Long getLong(java.lang.String key, long def) throws OrderException
Long
object.key
- The key of the parameter to find.def
- The default object associated with the parameter.Long
object. If the object cannot be found or converted to a Long
object, the default
object is returned.com.ibm.commerce.exception.OrderException
- Thrown if the value cannot be converted in to a Long object.OrderException
public java.lang.Long getLong(java.lang.String key, java.lang.Long def) throws OrderException
Long
object.key
- The key of the parameter to find.def
- The default object associated with the parameter.Long
object. If the value cannot be found or converted to a Long
, the default
object is returned.com.ibm.commerce.exception.OrderException
- Thrown if the value cannot be converted in to a Long object.OrderException
public java.lang.Long[] getLongArray(java.lang.String key) throws OrderException, OrderException
Long
objects.key
- The key of the parameter to find.Long
objects.com.ibm.commerce.exception.OrderException
- Thrown if the object cannot be converted in to an array of Long
objects.com.ibm.commerce.exception.OrderException
- Thrown if the parameter cannot be found.OrderException
public java.lang.Long[] getLongArray(java.lang.String key, java.lang.Long[] def)
Long
objects.key
- The key of the parameter to find.def
- The default object associated with the parameter.Long
objects. If the object cannot be found or converted to an array of Long
objects, the default
object is returned.public long getLongValue(java.lang.String key) throws OrderException
long
value.key
- The key of the parameter to find.long
value.com.ibm.commerce.exception.OrderException
- Thrown if the object cannot be converted to a long
value
or thrown if the parameter cannot be found.OrderException
public long getLongValue(java.lang.String key, long def) throws OrderException
long
value.key
- The key of the parameter to find.def
- The default object associated with the parameter.long
value. If the object cannot be found or converted to a long
value, the default
value is returned.com.ibm.commerce.exception.OrderException
- Thrown if the object cannot be converted to a long
value.OrderException
public java.lang.Short getShort(java.lang.String key) throws OrderException
Short
object.key
- The key of the parameter to find.Short
object.com.ibm.commerce.exception.OrderException
- Thrown if the object cannot be converted in to a Short
object
or thrown if the parameter cannot be found.OrderException
public java.lang.Short getShort(java.lang.String key, java.lang.Short def) throws OrderException
Short
object.key
- The key of the parameter to find.def
- The default object associated with the parameter.Short
object. If the object cannot be found or converted to a Short
object, the default
object is returned.com.ibm.commerce.exception.OrderException
- Thrown if the object cannot be converted in to a Short
object.OrderException
public java.lang.Short getShort(java.lang.String key, short def) throws OrderException
Short
object.key
- The key of the parameter to find.def
- The default object associated with the parameter.Short
object. If the object cannot be found or converted to a Short
object, the default
object is returned.com.ibm.commerce.exception.OrderException
- Thrown if the object cannot be converted in to a Short
object.OrderException
public short getShortValue(java.lang.String key) throws OrderException
short
value.key
- The key of the parameter to find.short
value.com.ibm.commerce.exception.OrderException
- Thrown if the object cannot be converted to a short
value
or thrown if the parameter cannot be found.OrderException
public short getShortValue(java.lang.String key, short def) throws OrderException
short
value..key
- The key of the parameter to find.def
- The default object associated with the parameter.short
value. If the object cannot be found or converted to a short
value, the default
value is returned.com.ibm.commerce.exception.OrderException
- Thrown if the object cannot be converted to a short
value.OrderException
public static java.lang.String objectToString(java.lang.Object aObject, java.lang.String def)
TypedProperty
object to a String
object. If the object is an array, the first element is converted.
If the object is null, the specified default object is returned.aObject
- The value to convert.def
- The default object.String
of the TypedProperty
object.public java.lang.String getString(java.lang.String key) throws OrderException
String
object.
If the object is an array and there is a non-null first element,
that element is converted to a String
by calling its toString()
method.
Otherwise, if the object is an array, but there is no non-null first element,
a OrderException
is thrown.
Otherwise, if the value is not null, it is converted to a String
by calling its toString()
method.
Otherwise, a OrderException
is thrown.key
- The key of the parameter to find.String
representation of the parameter.com.ibm.commerce.exception.OrderException
- Thrown if the parameter cannot be found.OrderException
public java.lang.String getString(java.lang.String key, java.lang.String def)
String
object.
If the object is an array and there is a non-null first element,
that element is converted to a String
by calling its toString()
method.
Otherwise, if the object is an array, but there is no non-null first element,
the specified default object is returned.
Otherwise, if the value is not null, it is converted to a String
by calling its toString()
method.
Otherwise, the specified default value is returned.key
- The key of the parameter to find.def
- The default object associated with the parameter.String
representation of the parameter. If the object cannot be found or converted to a String
object, the default
object is returned.public java.util.Map getMap()
public void setMap(java.util.Map argMap)
argMap
- The map to set.