Oracle Content Management SDK

oracle.ifs.common
Class ParameterTable

java.lang.Object
  |
  +--java.util.Dictionary
        |
        +--java.util.Hashtable
              |
              +--oracle.ifs.common.ParameterTable
All Implemented Interfaces:
java.lang.Cloneable, java.util.Map, java.io.Serializable

public class ParameterTable
extends java.util.Hashtable

This class contains a list of named parameters in a Hashtable. It extends java.util.Hashtable by providing a constructor to convert from a String [] of args in the forms of "key=value", where value can represent a string, integer, long, or boolean.

This class is used parsing command line and parameter file based args. It is typically used for command line type programs, and for constructing tests,

See Also:
Serialized Form

Constructor Summary
ParameterTable(java.lang.String[] args, java.lang.String filenameParameter)
          Constructs a ParameterTable.
 
Method Summary
 java.lang.Boolean getBoolean(java.lang.String name)
          Returns a Boolean object representing the first occurance of the passed name in an name/value pair.
 boolean getBoolean(java.lang.String name, boolean defaultValue)
          Returns a boolean representing the first occurance of the passed name in an name/value pair.
 java.lang.Integer getInteger(java.lang.String name)
          Returns an Integer object representing the first occurance of the passed name in an name/value pair.
 int getInteger(java.lang.String name, int defaultValue)
          Returns an int representing the first occurance of the passed name in an name/value pair.
 java.lang.String[] getKeys()
          Return the keys that are represented by this ParameterTable, in the order in which they were added.
 java.lang.Long getLong(java.lang.String name)
          Returns an Long object representing the first occurance of the passed name in an name/value pair.
 long getLong(java.lang.String name, long defaultValue)
          Returns an long representing the first occurance of the passed name in an name/value pair.
 java.lang.String[] getSectionKeys()
          Return the section keys that are represented by this ParameterTable, in the order in which they were added.
 java.lang.String getString(java.lang.String name)
          Returns a String object representing the first occurance of the passed name in an name/value pair.
 java.lang.String getString(java.lang.String name, java.lang.String defaultValue)
          Returns a String object representing the first occurance of the passed name in an name/value pair.
 java.lang.String[] getStrings(java.lang.String name)
          Returns a Strings array object for a named parameter.
 

Constructor Detail


ParameterTable

public ParameterTable(java.lang.String[] args,
                      java.lang.String filenameParameter)
Constructs a ParameterTable.

The items in the ParameterTable can be obtained from either an array of name/value pairs or a file containing a set of name/value pairs, one per line.

For example, new ParameterTable(new String[] { "foo=1", "bar=2", "myParameterFile=Test.def" }, "myParameterFile") constructs a ParameterTable containing values for foo, bar, plus whatever name/value pairs are in the file Test.def.

Items in the array of name/value pairs always override like-named parameters in the file.

Parameters:
args - a set of name/value pairs, in the form name=value
filenameParameter - the name of the parameter whose value is the name of a file containing a set of name/value pairs
Method Detail

getString

public java.lang.String getString(java.lang.String name)
Returns a String object representing the first occurance of the passed name in an name/value pair. If no parameter matching the name can be found null is returned.
Parameters:
name - The parameter name in a name value pair.
Returns:
A String object corresponding to the name's value, or null if the name cannot be found.

getString

public java.lang.String getString(java.lang.String name,
                                  java.lang.String defaultValue)
Returns a String object representing the first occurance of the passed name in an name/value pair. If no parameter matching the name can be found, the specified default value is returned.
Parameters:
name - The parameter name in a name value pair.
defaultValue - Value to reutn if name is not found
Returns:
A String object corresponding to the name's value, or defaultValue if the name cannot be found.

getStrings

public java.lang.String[] getStrings(java.lang.String name)
Returns a Strings array object for a named parameter. If the value was not multivalued, just return an array with one element.
Parameters:
name - The parameter name in a name value pair.
Returns:
A String array corresponding to the name's value, or null if the name cannot be found.

getInteger

public java.lang.Integer getInteger(java.lang.String name)
Returns an Integer object representing the first occurance of the passed name in an name/value pair. If no parameter matching the name can be found null is returned.
Parameters:
name - The parameter name in a name value pair.
Returns:
An Integer object corresponding to the name's value, or null if the name cannot be found.

getInteger

public int getInteger(java.lang.String name,
                      int defaultValue)
Returns an int representing the first occurance of the passed name in an name/value pair. If no parameter matching the name can be found, the default value is returned.
Parameters:
name - The parameter name in a name value pair.
defaultValue - Default value if name is not found.
Returns:
An Integer object corresponding to the name's value, or null if the name cannot be found.

getLong

public java.lang.Long getLong(java.lang.String name)
Returns an Long object representing the first occurance of the passed name in an name/value pair. If no parameter matching the name can be found null is returned.
Parameters:
name - The parameter name in a name value pair.
Returns:
An Long object corresponding to the name's value, or null if the name cannot be found.

getLong

public long getLong(java.lang.String name,
                    long defaultValue)
Returns an long representing the first occurance of the passed name in an name/value pair. If no parameter matching the name can be found, the default value is returned.
Parameters:
name - The parameter name in a name value pair.
defaultValue - Default value if name is not found.
Returns:
An Long object corresponding to the name's value, or null if the name cannot be found.

getBoolean

public java.lang.Boolean getBoolean(java.lang.String name)
Returns a Boolean object representing the first occurance of the passed name in an name/value pair. If no parameter matching the name can be found null is returned.
Parameters:
name - The parameter name in a name value pair.
Returns:
A Boolean object corresponding to the name's value, or null if the name cannot be found.

getBoolean

public boolean getBoolean(java.lang.String name,
                          boolean defaultValue)
Returns a boolean representing the first occurance of the passed name in an name/value pair. If no parameter matching the name can be found, the default value is returned.
Parameters:
name - The parameter name in a name value pair.
defaultValue - Default value if name is not found.
Returns:
A Boolean object corresponding to the name's value, or null if the name cannot be found.

getKeys

public java.lang.String[] getKeys()
Return the keys that are represented by this ParameterTable, in the order in which they were added. Section keys are not included in the returned array of keys.
Returns:
the array of keys

getSectionKeys

public java.lang.String[] getSectionKeys()
Return the section keys that are represented by this ParameterTable, in the order in which they were added.
Returns:
the array of section keys

Oracle Content Management SDK

(c) 2002 Copyright Oracle Corporation. All rights reserved.