edu.indiana.dlib.metsnav.config.parameter
Class ParameterMap

java.lang.Object
  extended by java.util.Dictionary<K,V>
      extended by java.util.Hashtable<Object,Object>
          extended by java.util.Properties
              extended by edu.indiana.dlib.metsnav.config.parameter.ParameterMap
All Implemented Interfaces:
Serializable, Cloneable, Map<Object,Object>

public class ParameterMap
extends Properties
implements Cloneable

This is a class that can be used to contain all URL parameters and their possible values for an action class. It keeps a HashMap - the parameter name as the key, and a list of its possible values as the value in the hash. It extends from the class java.util.Properties. For each parameter, it also keeps a single value as the current parameter value.

Author:
David Jiao
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.Properties
defaults
 
Constructor Summary
ParameterMap()
          Creates a new instance
 
Method Summary
 Object clone()
          This is a deep clone method which returns a cloned instance of ParameterMap.
 int getNumberOfValues(String key)
          Returns number of possible values for the key
 String getPrintedParameter(String parameter)
          Returns the parameter as a url parameter
 String getPrintedParameters()
          Returns a string of all parameter-value pair in URL format
 String getValue(String key)
          Returns the value for a paramter key
 String getValueAtIndex(String key, int index)
          Returns the value at certain index in the possible value list for a parameter key
 HashMap getValueMap()
          Returns the valueMap
 List getValuesOf(String key)
          Returns all possible values of a parameter key
 String print()
          Returns URL formatted string for all parameters.
 String print(String key)
          Returns a URL parameter string for a property with key
 void putValues(String key, List valueList)
          Set possible values for a parameter key
 void setValueMap(HashMap map)
          Sets the valueMap
 String toString()
           
 
Methods inherited from class java.util.Properties
getProperty, getProperty, list, list, load, loadFromXML, propertyNames, save, setProperty, store, storeToXML, storeToXML
 
Methods inherited from class java.util.Hashtable
clear, 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
 

Constructor Detail

ParameterMap

public ParameterMap()
Creates a new instance

Method Detail

clone

public Object clone()
This is a deep clone method which returns a cloned instance of ParameterMap.

Overrides:
clone in class Hashtable<Object,Object>
Returns:
deep cloned instance of ParameterMap

getNumberOfValues

public int getNumberOfValues(String key)
Returns number of possible values for the key

Parameters:
key -
Returns:
number of possible values for the key

getPrintedParameter

public String getPrintedParameter(String parameter)
Returns the parameter as a url parameter

Parameters:
parameter -
Returns:

getPrintedParameters

public String getPrintedParameters()
Returns a string of all parameter-value pair in URL format

Returns:

getValue

public String getValue(String key)
Returns the value for a paramter key

Parameters:
key -
Returns:

getValueAtIndex

public String getValueAtIndex(String key,
                              int index)
Returns the value at certain index in the possible value list for a parameter key

Parameters:
key -
index -
Returns:

getValueMap

public HashMap getValueMap()
Returns the valueMap

Returns:
the valueMap

getValuesOf

public List getValuesOf(String key)
Returns all possible values of a parameter key

Parameters:
key -
Returns:

print

public String print()
Returns URL formatted string for all parameters. The format is &key1=value1&key2=value2&key3=value3...

Returns:

print

public String print(String key)
Returns a URL parameter string for a property with key

Parameters:
key -
Returns:

putValues

public void putValues(String key,
                      List valueList)
Set possible values for a parameter key

Parameters:
key -
valueList -

setValueMap

public void setValueMap(HashMap map)
Sets the valueMap

Parameters:
map -

toString

public String toString()
Overrides:
toString in class Hashtable<Object,Object>


Copyright © 2005 Trustees of Indiana University. All Rights Reserved.