com.ibm.etill.framework.payapi
Class ParameterTable

java.lang.Object
  |
  +--java.util.Dictionary
        |
        +--java.util.Hashtable
              |
              +--com.ibm.etill.framework.payapi.ParameterTable
All Implemented Interfaces:
Cloneable, Map, Serializable

public class ParameterTable
extends Hashtable
implements Serializable

ParameterTable objects map keys to values where any non-null object can be a key and any object can be a value. ParameterTable is a highfalutin version of Hashtable by allowing a null to be inserted as a value into the table.

To successfully store and retrieve value objects from a ParameterTable, key objects must implement the hashCode method and the equals method.

See Also:
Hashtable, Serialized Form

Inner classes inherited from class java.util.Map
Map.Entry
 
Constructor Summary
ParameterTable()
          This Constructor should be called when an empty ParameterTable is to be instantiated.
ParameterTable(Hashtable parameterTable)
          This Constructor should be called when an ParameterTable is to be initialized with a given Hashtable object when instantiated.
 
Method Summary
 Object clone()
          Creates a copy of this ParameterTable.
 boolean contains(Object value)
          Tests if some key maps into the specified value in this parameter table.
 Enumeration elements()
          If this method is called, an exception will be thrown.
 Object get(Object key)
          Returns the value entry that is paired with the given key entry or returns null when the key is not found.
 Object get(Object key, Object defaultReturnValue)
          Returns the value entry that is paired with the given key entry or returns the defaultReturnValue when the key is not found.
 Object put(Object key, Object value)
          Inserts a given key/value pair into the table and returns the key's previous value or a null if the key was not previously inserted.
 Object put(Object key, Object value, Object defaultReturnValue)
          Inserts a given key/value pair into the table and returns the key's previous value or the defaultReturnValue if the key was not previously inserted.
 Object remove(Object key)
          Deletes a key/value pair by searching for a given key.
 Object remove(Object key, Object defaultReturnValue)
          Deletes a key/value pair by searching for a given key.
 
Methods inherited from class java.util.Hashtable
clear, containsKey, containsValue, entrySet, equals, hashCode, isEmpty, keys, keySet, putAll, size, toString, values
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ParameterTable

public ParameterTable()
This Constructor should be called when an empty ParameterTable is to be instantiated. This constructor has no functionality.

ParameterTable

public ParameterTable(Hashtable parameterTable)
This Constructor should be called when an ParameterTable is to be initialized with a given Hashtable object when instantiated.
Parameters:
parameterTable - a Hashtable object to initialize this ParameterTable
Method Detail

elements

public Enumeration elements()
If this method is called, an exception will be thrown. A caller must find an alternative way to retrieve a list of values.
Overrides:
elements in class Hashtable

clone

public Object clone()
Creates a copy of this ParameterTable.
Overrides:
clone in class Hashtable
Returns:
Object - copy of this ParameterTable

get

public Object get(Object key,
                  Object defaultReturnValue)
Returns the value entry that is paired with the given key entry or returns the defaultReturnValue when the key is not found.
Parameters:
key - index to the value object that the caller wants
defaultReturnValue - if the key is not found in the table, this will be returned to the caller
Returns:
Object - value object found in the table, or defaultReturnValue if the key was not found

get

public Object get(Object key)
Returns the value entry that is paired with the given key entry or returns null when the key is not found.
Overrides:
get in class Hashtable
Parameters:
key - index to the value object that the caller wants
Returns:
Object - the value to which the key is mapped, or null if the key was not found

remove

public Object remove(Object key,
                     Object defaultReturnValue)
Deletes a key/value pair by searching for a given key. If the key is not found in the table, defaultReturnValue is returned to the caller. If the key is found, the Object is returned and removed from the table.
Parameters:
key - index to the value object that the caller wants to remove
defaultReturnValue - if the key is not found in the table, this will be returned to the caller
Returns:
Object - the value to which the key had been mapped, or defaultReturnValue if the key was not found

remove

public Object remove(Object key)
Deletes a key/value pair by searching for a given key. If the key is found, the Object is returned and removed from the table.
Overrides:
remove in class Hashtable
Parameters:
key - index to the value object that the caller wants to remove
Returns:
Object - the value to which the key had been mapped, or null if the key was not found

contains

public boolean contains(Object value)
Tests if some key maps into the specified value in this parameter table. This operation is more expensive than the containsKey method.
Overrides:
contains in class Hashtable
Parameters:
key - object to search for
Returns:
boolean - true if the value is found in the table, false otherwise

put

public Object put(Object key,
                  Object value,
                  Object defaultReturnValue)
Inserts a given key/value pair into the table and returns the key's previous value or the defaultReturnValue if the key was not previously inserted.
Parameters:
key - the parametertable key/index
value - the value to be set with this key
defaultReturnValue - object returned if the given key was not previously inserted into the table
Returns:
Object - the previous value of the key in this table, or defaultReturnValue otherwise

put

public Object put(Object key,
                  Object value)
Inserts a given key/value pair into the table and returns the key's previous value or a null if the key was not previously inserted.
Overrides:
put in class Hashtable
Parameters:
key - the ParameterTable key (index)
value - the value to be set with this key
Returns:
Object - the previous value of the key in this table, or null otherwise