com.ibm.commerce.datatype
Class TypedProperty

java.lang.Object
  |
  +--java.util.Dictionary
        |
        +--java.util.Hashtable
              |
              +--com.ibm.commerce.datatype.TypedProperty
All Implemented Interfaces:
java.lang.Cloneable, java.util.Map, java.io.Serializable

public class TypedProperty
extends java.util.Hashtable

TypedProperties extends the Hashtable. It provides additional methods for retrieving properties as integer, double, float instead of string.

See Also:
Serialized Form

Inner classes inherited from class java.util.Map
java.util.Map.Entry
 
Field Summary
protected static com.ibm.commerce.datatype.UrlParamMapperFile urlMapperFile
           
protected  java.util.Hashtable urlNameMapper
           
 
Constructor Summary
TypedProperty()
          TypedProperty constructor comment.
TypedProperty(java.util.Hashtable hTP)
          Construct a TypedProperty object from a Hashtable.
TypedProperty(int initialCapacity)
          TypedProperty constructor comment.
TypedProperty(int initialCapacity, float loadFactor)
          TypedProperty constructor comment.
 
Method Summary
static TypedProperty createTextResponse(java.lang.String textResponse)
          Prepare a TypedProperty object for sending text response
 java.lang.Object get(java.lang.String key)
          Return the value associated with the key
 java.lang.Object get(java.lang.String key, java.lang.Object def)
          Return the value associated with the key
 java.lang.String[] getArray(java.lang.String key)
          Return the value associated with the key as a String array
 java.lang.String[] getArray(java.lang.String key, java.lang.String[] def)
          Return the value associated with the key as a String array
 java.math.BigDecimal getBigDecimal(java.lang.String key)
          Return the value associated with the key
 java.math.BigDecimal getBigDecimal(java.lang.String key, java.math.BigDecimal def)
          Return the value associated with the key
 boolean getBoolean(java.lang.String key)
          returns the value associated with the key.
 boolean getBoolean(java.lang.String key, boolean def)
          Return the value associated with the key
 java.lang.Double getDouble(java.lang.String key)
          Return the value associated with the key
 java.lang.Double getDouble(java.lang.String key, double def)
          Return the value associated with the key
 java.lang.Double getDouble(java.lang.String key, java.lang.Double def)
          Return the value associated with the key
 double getDoubleValue(java.lang.String key)
          Return the value associated with the key
 double getDoubleValue(java.lang.String key, double def)
          Return the value associated with the key
 java.lang.Float getFloat(java.lang.String key)
          Return the value associated with the key
 java.lang.Float getFloat(java.lang.String key, float def)
          Return the value associated with the key
 java.lang.Float getFloat(java.lang.String key, java.lang.Float def)
          Return the value associated with the key
 float getFloatValue(java.lang.String key)
          Return the value associated with the key
 float getFloatValue(java.lang.String key, float def)
          Return the value associated with the key
 java.lang.Integer getInteger(java.lang.String key)
          Return the value associated with the key
 java.lang.Integer getInteger(java.lang.String key, int def)
          Return the value associated with the key
 java.lang.Integer getInteger(java.lang.String key, java.lang.Integer def)
          Return the value associated with the key
 java.lang.String getIntParamName(java.lang.String key)
          Return the value associated with the key as a string.
 int getIntValue(java.lang.String key)
          get the Integer Value
 int getIntValue(java.lang.String key, int def)
          Return the value associated with the key
 java.lang.Long getLong(java.lang.String key)
          Return the value associated with the key in Long
 java.lang.Long getLong(java.lang.String key, long def)
          Return the value associated with the key
 java.lang.Long getLong(java.lang.String key, java.lang.Long def)
          Return the value associated with the key
 java.lang.Long[] getLongArray(java.lang.String key)
          Return the value associated with the key as an array of Long
 java.lang.Long[] getLongArray(java.lang.String key, java.lang.Long[] def)
          Return the value associated with the key as a String array
 long getLongValue(java.lang.String key)
          returns the value associated with the key.
 long getLongValue(java.lang.String key, long def)
          Return the value associated with the key
 java.lang.String getQueryString()
          Return the context of this TypedProperty as a query string.
 java.lang.Short getShort(java.lang.String key)
          Return the value associated with the key
 java.lang.Short getShort(java.lang.String key, short def)
          Return the value associated with the key
 java.lang.Short getShort(java.lang.String key, java.lang.Short def)
          Return the value associated with the key
 short getShortValue(java.lang.String key)
          returns the value associated with the key.
 short getShortValue(java.lang.String key, short def)
          Return the value associated with the key
 java.lang.String getString(java.lang.String key)
          Return the value associated with the key as a string.
 java.lang.String getString(java.lang.String key, java.lang.String def)
          Return the value associated with the key.
 java.lang.Object getUrlParam(java.lang.String key)
          Return the value associated with the url parameter name as a string.
 java.lang.String getUrlParamName(java.lang.String key)
          Given an internal parameter name, return the corresponding url parameter name.
static void initUrlParamNameMapper(com.ibm.commerce.datatype.UrlParamMapperFile mapper)
          Initialize the url parameter name mapper.
 void putUrlParam(java.lang.String key, java.lang.Object obj)
          Add a new property using the url parameter name as key.
 java.lang.String toProtectedString()
          Return a string that represents that context of this TypedProperty.
 java.lang.String toString()
          Return a string that represents that context of this TypedProperty.
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

urlMapperFile

protected static com.ibm.commerce.datatype.UrlParamMapperFile urlMapperFile

urlNameMapper

protected java.util.Hashtable urlNameMapper
Constructor Detail

TypedProperty

public TypedProperty()
TypedProperty constructor comment.

TypedProperty

public TypedProperty(java.util.Hashtable hTP)
Construct a TypedProperty object from a Hashtable.

Parameters:
hashtable - Hashtable - input hashtable

TypedProperty

public TypedProperty(int initialCapacity)
TypedProperty constructor comment.
Parameters:
initialCapacity - int

TypedProperty

public TypedProperty(int initialCapacity,
                     float loadFactor)
TypedProperty constructor comment.
Parameters:
initialCapacity - int
loadFactor - float
Method Detail

createTextResponse

public static TypedProperty createTextResponse(java.lang.String textResponse)
Prepare a TypedProperty object for sending text response
Parameters:
textResponse - java.lang.String - text to be returned
Returns:
com.ibm.commerce.datatype.TypedProperty

get

public java.lang.Object get(java.lang.String key)
                     throws ParameterNotFoundException
Return the value associated with the key
Parameters:
key - java.lang.String
Returns:
Object
Throws:
ParameterNotFoundException -  

get

public java.lang.Object get(java.lang.String key,
                            java.lang.Object def)
Return the value associated with the key
Parameters:
key - java.lang.String
Returns:
Object

getArray

public java.lang.String[] getArray(java.lang.String key)
                            throws ParameterNotFoundException,
                                   InvalidParameterValueException
Return the value associated with the key as a String array
Parameters:
key - java.lang.String
Returns:
String[]
Throws:
InvalidParameterValueException -  
ParameterNotFoundException -  

getArray

public java.lang.String[] getArray(java.lang.String key,
                                   java.lang.String[] def)
Return the value associated with the key as a String array
Parameters:
key - java.lang.String
def - String[] - default value to be returned if paramter is not found or if it cannot be returned as an array of strings
Returns:
String[]

getBigDecimal

public java.math.BigDecimal getBigDecimal(java.lang.String key)
                                   throws ParameterNotFoundException,
                                          InvalidParameterValueException
Return the value associated with the key
Parameters:
key - java.lang.String
Returns:
BigDecimal
Throws:
java.lang.NumberFormatException - The exception description.
ParameterNotFoundException -  

getBigDecimal

public java.math.BigDecimal getBigDecimal(java.lang.String key,
                                          java.math.BigDecimal def)
Return the value associated with the key
Parameters:
key - java.lang.String
Returns:
BigDecimal
Throws:
java.lang.NumberFormatException - The exception description.
ParameterNotFoundException -  

getBoolean

public boolean getBoolean(java.lang.String key)
                   throws ParameterNotFoundException
returns the value associated with the key.
Parameters:
key - java.lang.String
Returns:
boolean
Throws:
ParameterNotFoundException -  

getBoolean

public boolean getBoolean(java.lang.String key,
                          boolean def)
Return the value associated with the key
Parameters:
key - java.lang.String
def - boolean - default value
Returns:
boolean

getDouble

public java.lang.Double getDouble(java.lang.String key)
                           throws ParameterNotFoundException,
                                  InvalidParameterValueException
Return the value associated with the key
Parameters:
key - java.lang.String
Returns:
Double
Throws:
InvalidParameterValueException -  
ParameterNotFoundException -  

getDouble

public java.lang.Double getDouble(java.lang.String key,
                                  double def)
Return the value associated with the key
Parameters:
key - java.lang.String
def - double - default value to be returned
Returns:
Double

getDouble

public java.lang.Double getDouble(java.lang.String key,
                                  java.lang.Double def)
Return the value associated with the key
Parameters:
key - java.lang.String
def - Double
Returns:
Double

getDoubleValue

public double getDoubleValue(java.lang.String key)
                      throws ParameterNotFoundException
Return the value associated with the key
Parameters:
key - java.lang.String
Returns:
double
Throws:
java.lang.NumberFormatException - The exception description.
ParameterNotFoundException -  

getDoubleValue

public double getDoubleValue(java.lang.String key,
                             double def)
Return the value associated with the key
Parameters:
key - java.lang.String
def - double
Returns:
double

getFloat

public java.lang.Float getFloat(java.lang.String key)
                         throws ParameterNotFoundException,
                                InvalidParameterValueException
Return the value associated with the key
Parameters:
key - java.lang.String
Returns:
Float
Throws:
InvalidParameterValueException -  
ParameterNotFoundException -  

getFloat

public java.lang.Float getFloat(java.lang.String key,
                                float def)
Return the value associated with the key
Parameters:
key - java.lang.String
def - float
Returns:
Float

getFloat

public java.lang.Float getFloat(java.lang.String key,
                                java.lang.Float def)
Return the value associated with the key
Parameters:
key - java.lang.String
def - Float
Returns:
Float

getFloatValue

public float getFloatValue(java.lang.String key)
                    throws ParameterNotFoundException,
                           InvalidParameterValueException
Return the value associated with the key
Parameters:
key - java.lang.String
Returns:
float
Throws:
InvalidParameterValueException -  
ParameterNotFoundException -  

getFloatValue

public float getFloatValue(java.lang.String key,
                           float def)
Return the value associated with the key
Parameters:
key - java.lang.String
def - float
Returns:
float

getInteger

public java.lang.Integer getInteger(java.lang.String key)
                             throws ParameterNotFoundException,
                                    InvalidParameterValueException
Return the value associated with the key
Parameters:
key - java.lang.String
Returns:
Integer
Throws:
InvalidParameterValueException -  
ParameterNotFoundException -  

getInteger

public java.lang.Integer getInteger(java.lang.String key,
                                    int def)
Return the value associated with the key
Parameters:
key - java.lang.String
def - int
Returns:
Integer

getInteger

public java.lang.Integer getInteger(java.lang.String key,
                                    java.lang.Integer def)
Return the value associated with the key
Parameters:
key - java.lang.String
def - Integer
Returns:
Integer

getIntParamName

public java.lang.String getIntParamName(java.lang.String key)
Return the value associated with the key as a string. If the value associated with the key is a String Array, then the first element of the array is returned. Otherwise, this method will return the string representation of the entire object.
Parameters:
key - java.lang.String - rul parameter name
obj - Object - parameter value
Throws:
com.ibm.commerce.exception.ParameterNotFound. -  

getIntValue

public int getIntValue(java.lang.String key)
                throws ParameterNotFoundException,
                       InvalidParameterValueException
get the Integer Value
Parameters:
key - java.lang.String com.ibm.commerce.exception.InvalidParameterValueException com.ibm.commerce.exception.ParameterNotFoundException
Returns:
int

getIntValue

public int getIntValue(java.lang.String key,
                       int def)
Return the value associated with the key
Parameters:
key - - java.lang.String
def - - int, the default value
Returns:
int

getLong

public java.lang.Long getLong(java.lang.String key)
                       throws ParameterNotFoundException,
                              InvalidParameterValueException
Return the value associated with the key in Long

Parameters:
key - java.lang.String
Returns:
Long
Throws:
InvalidParameterValueException -  
ParameterNotFoundException -  

getLong

public java.lang.Long getLong(java.lang.String key,
                              long def)
Return the value associated with the key
Parameters:
key - java.lang.String
def - longs
Returns:
Long

getLong

public java.lang.Long getLong(java.lang.String key,
                              java.lang.Long def)
Return the value associated with the key
Parameters:
key - java.lang.String
def - Long
Returns:
Long

getLongArray

public java.lang.Long[] getLongArray(java.lang.String key)
                              throws ParameterNotFoundException,
                                     InvalidParameterValueException
Return the value associated with the key as an array of Long
Parameters:
key - java.lang.String
Returns:
Long[]
Throws:
InvalidParameterValueException -  
ParameterNotFoundException -  

getLongArray

public java.lang.Long[] getLongArray(java.lang.String key,
                                     java.lang.Long[] def)
Return the value associated with the key as a String array
Parameters:
key - java.lang.String
Returns:
String[]
Throws:
InvalidParameterValueException -  
ParameterNotFoundException -  

getLongValue

public long getLongValue(java.lang.String key)
                  throws ParameterNotFoundException,
                         InvalidParameterValueException
returns the value associated with the key.
Parameters:
key - java.lang.String
Returns:
long
Throws:
InvalidParameterValueException -  
ParameterNotFoundException -  

getLongValue

public long getLongValue(java.lang.String key,
                         long def)
Return the value associated with the key
Parameters:
key - java.lang.String
def - long default long value
Returns:
long

getQueryString

public java.lang.String getQueryString()
Return the context of this TypedProperty as a query string.
Returns:
String

getShort

public java.lang.Short getShort(java.lang.String key)
                         throws InvalidParameterValueException,
                                ParameterNotFoundException
Return the value associated with the key
Parameters:
key - java.lang.String
Returns:
Short
Throws:
InvalidParameterValueException -  
ParameterNotFoundException -  

getShort

public java.lang.Short getShort(java.lang.String key,
                                short def)
Return the value associated with the key
Parameters:
key - java.lang.String
def - int
Returns:
Short

getShort

public java.lang.Short getShort(java.lang.String key,
                                java.lang.Short def)
Return the value associated with the key
Parameters:
key - java.lang.String
def - Short
Returns:
Short

getShortValue

public short getShortValue(java.lang.String key)
                    throws ParameterNotFoundException,
                           InvalidParameterValueException
returns the value associated with the key.
Parameters:
key - java.lang.String
Returns:
short
Throws:
InvalidParameterValueException -  
ParameterNotFoundException -  

getShortValue

public short getShortValue(java.lang.String key,
                           short def)
Return the value associated with the key
Parameters:
key - java.lang.String
def - short - default short value
Returns:
short

getString

public java.lang.String getString(java.lang.String key)
                           throws ParameterNotFoundException
Return the value associated with the key as a string. If the value associated with the key is a String Array, then the first element of the array is returned. Otherwise, this method will return the string representation of the entire object.
Parameters:
key - java.lang.String
Returns:
String
Throws:
com.ibm.commerce.exception.ParameterNotFound. -  

getString

public java.lang.String getString(java.lang.String key,
                                  java.lang.String def)
Return the value associated with the key. If the string is not found, return the default string
Parameters:
key - java.lang.String
def - String - a default string
Returns:
String

getUrlParam

public java.lang.Object getUrlParam(java.lang.String key)
Return the value associated with the url parameter name as a string.

Parameters:
key - java.lang.String - url parameter name
Returns:
obj Object - parameter value

getUrlParamName

public java.lang.String getUrlParamName(java.lang.String key)
Given an internal parameter name, return the corresponding url parameter name.
Parameters:
key - java.lang.String - internal name for the url parameter
Returns:
String - the url parameter name

initUrlParamNameMapper

public static void initUrlParamNameMapper(com.ibm.commerce.datatype.UrlParamMapperFile mapper)
Initialize the url parameter name mapper.
Parameters:
key - java.lang.String - the xml file that defines the url parameter name mapping
Returns:
String - the url parameter name

putUrlParam

public void putUrlParam(java.lang.String key,
                        java.lang.Object obj)
Add a new property using the url parameter name as key.

Parameters:
key - java.lang.String - url parameter name
obj - Object - parameter value

toProtectedString

public java.lang.String toProtectedString()
Return a string that represents that context of this TypedProperty.

Returns:
String

toString

public java.lang.String toString()
Return a string that represents that context of this TypedProperty.

Overrides:
toString in class java.util.Hashtable
Returns:
String