net.firstpartners.nounit.ui.common
Class AbstractPackage

java.lang.Object
  |
  +--net.firstpartners.nounit.ui.common.AbstractPackage
Direct Known Subclasses:
CommandPackage

public abstract class AbstractPackage
extends java.lang.Object

An abstract package that encapsulates a hashtable to provide conversion of command-line arguments


Field Summary
protected  java.util.HashMap innerValuePairs
           
 
Constructor Summary
protected AbstractPackage()
          default constructor
protected AbstractPackage(java.lang.Object[] inValues)
          Constructor builds Package using Standard Values (as from command Line) Overwrites any Previous Values
 
Method Summary
 void addAdditionalValue(java.lang.String key, java.lang.Object value)
          Add the value pairs to the internal store - do not overwrite , but convert to vector
 void addIfEmpty(java.lang.String keyName, java.lang.Object storeObject)
          adds a value to the internal store , only if previous value was null / empty
protected  void addValue(java.lang.Object[] inValues)
          Add set of KeyName - ValueName (in one array) to object , used by Constructor , and classes inheriting from this one Overwrites any existing values with same name
 void addValue(java.lang.Object keyName, java.lang.Object storeObject)
          adds a value to the internal store Overwrites any existing values with same name
 void addValues(java.util.HashMap valuesToAdd)
          Set the Values in the web package , given a hashtable Overwrites any existing values with same name
 void addValues(java.lang.String[] inValues)
          Add the value pairs to the internal store
Overwrites any existing values with same name
 int getInt(java.lang.String keyName)
          Get the Value as an int (Convience Method)
 java.util.Iterator getStoreNames()
          Gets the names of values stored in this webpackage
 java.lang.String getString(java.lang.String keyName)
          Get the Value as a String (Convience Method)
 java.lang.Object getValue(java.lang.String keyName)
          gets the value associated with the key name , as passed in from the Servlet, command line
 java.util.HashMap getValuePairs()
          Method to return a hashtable of value pairs
 java.util.Vector getVector(java.lang.String keyName)
          Get the Value as a Vector (Convience Method)
 void move(java.lang.String oldKey, java.lang.String newKey)
          Moves Objects from one key to another will overwrite anything (previously)held at the new key
 void printToOutputStream(java.io.PrintStream out)
          Prints the internal represenation of the Package to an output stream for debugging
 void remove(java.lang.Object key)
          Remove a value from the internal store
 java.lang.String toString()
          Prints the internal represenation of the Package to an output stream for debugging
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

innerValuePairs

protected java.util.HashMap innerValuePairs
Constructor Detail

AbstractPackage

protected AbstractPackage()
default constructor

AbstractPackage

protected AbstractPackage(java.lang.Object[] inValues)
Constructor builds Package using Standard Values (as from command Line) Overwrites any Previous Values
Parameters:
inValues - pairs as generated by the command line
Method Detail

addValue

protected void addValue(java.lang.Object[] inValues)
Add set of KeyName - ValueName (in one array) to object , used by Constructor , and classes inheriting from this one Overwrites any existing values with same name
Parameters:
inValues - - Array of keys and values to add

getValue

public java.lang.Object getValue(java.lang.String keyName)
gets the value associated with the key name , as passed in from the Servlet, command line
Parameters:
keyName - - the name the value is stored under.
Returns:
associatedValue - the value that was set under this name

addValue

public void addValue(java.lang.Object keyName,
                     java.lang.Object storeObject)
adds a value to the internal store Overwrites any existing values with same name
Parameters:
keyName - to store the object under for later retrieval
storeObject - to keep internally

getStoreNames

public java.util.Iterator getStoreNames()
Gets the names of values stored in this webpackage
Returns:
returnEnum of Names values are stored under in this package

getValuePairs

public java.util.HashMap getValuePairs()
Method to return a hashtable of value pairs
Returns:
innerValuePairs

addValues

public void addValues(java.util.HashMap valuesToAdd)
Set the Values in the web package , given a hashtable Overwrites any existing values with same name
Parameters:
valuesToAdd -  

getString

public java.lang.String getString(java.lang.String keyName)
Get the Value as a String (Convience Method)
Parameters:
keyName - of Value to find
Returns:
valueString that is stored under this string , "" if nothing

getVector

public java.util.Vector getVector(java.lang.String keyName)
Get the Value as a Vector (Convience Method)
Parameters:
keyName - of Value to find
Returns:
valueVector that is stored under this string , empty Vector if no value stored internally under this name

getInt

public int getInt(java.lang.String keyName)
Get the Value as an int (Convience Method)
Parameters:
keyName - of Value to find
Returns:
int that is stored under this string , empty Vector if no value stored internally under this name

printToOutputStream

public void printToOutputStream(java.io.PrintStream out)
Prints the internal represenation of the Package to an output stream for debugging
Parameters:
out - - java.io.PrintStream to print to

toString

public java.lang.String toString()
Prints the internal represenation of the Package to an output stream for debugging
Overrides:
toString in class java.lang.Object
Returns:
out - java.io.PrintStream to print to

addAdditionalValue

public void addAdditionalValue(java.lang.String key,
                               java.lang.Object value)
Add the value pairs to the internal store - do not overwrite , but convert to vector
Parameters:
key - object
value - object

addValues

public void addValues(java.lang.String[] inValues)
Add the value pairs to the internal store
Overwrites any existing values with same name
Parameters:
inValues - - Array to add to Value pairs e.g. key1 , value1, key2 , value2

remove

public void remove(java.lang.Object key)
Remove a value from the internal store
Parameters:
key - of object to remove

move

public void move(java.lang.String oldKey,
                 java.lang.String newKey)
Moves Objects from one key to another will overwrite anything (previously)held at the new key
Parameters:
oldKey - - String
newKey - - String

addIfEmpty

public void addIfEmpty(java.lang.String keyName,
                       java.lang.Object storeObject)
adds a value to the internal store , only if previous value was null / empty
Parameters:
keyName - to store the object under for later retrieval
storeObject - to keep internally