org.enhydra.zeus.util
Class Arguments

java.lang.Object
  |
  +--java.util.Dictionary
        |
        +--java.util.Hashtable
              |
              +--org.enhydra.zeus.util.Arguments
All Implemented Interfaces:
java.lang.Cloneable, java.util.Map, java.io.Serializable

public class Arguments
extends java.util.Hashtable

Arguments is a Zeus utility class that provides for converting arguments passed to a class in the -param=value format into a Hashtable like container. This makes it possible to pass arguments in any order.

Author:
Brooke Hedrick
See Also:
Serialized Form

Inner classes inherited from class java.util.Map
java.util.Map.Entry
 
Constructor Summary
Arguments()
          Constructor to delegate instantiation.
Arguments(java.lang.String[] args)
           This will take the arguments passed to a main method with the arguments specified as "-argument1=value -argument2=value" and place these in a Hashtable keyed by the argument name.
 
Method Summary
 java.lang.String getValue(java.lang.String argumentName)
           This will take a String as the argument name, and return the parameter value.
 boolean hasValue(java.lang.String argumentName)
           This will take a String as the argument name, and return true if an argument by that name exists, otherwise.
 void setValue(java.lang.String argumentName, java.lang.String argumentValue)
           This will take a String as the argument name, and another String as the argument value in.
 void setValues(java.lang.String[] args)
           This will take a String[] as an array of "-argument=value" pairs and add to/update the Hashtable containing the arguments.
 
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, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Arguments

public Arguments()

Constructor to delegate instantiation.


Arguments

public Arguments(java.lang.String[] args)

This will take the arguments passed to a main method with the arguments specified as "-argument1=value -argument2=value" and place these in a Hashtable keyed by the argument name.

Parameters:
args - String[] initial arguments to add.
Method Detail

getValue

public java.lang.String getValue(java.lang.String argumentName)

This will take a String as the argument name, and return the parameter value.

Parameters:
argument - String argument to find.
Returns:
String - the value of the argument.

hasValue

public boolean hasValue(java.lang.String argumentName)

This will take a String as the argument name, and return true if an argument by that name exists, otherwise. it will return false

Parameters:
argumentName - String argument to find.
Returns:
boolean - whether or not the argument exists.

setValue

public void setValue(java.lang.String argumentName,
                     java.lang.String argumentValue)

This will take a String as the argument name, and another String as the argument value in. order to add a new argument/value to the list of arguments

Parameters:
argumentName - String argument to add.
argumentValue - String value of argument.

setValues

public void setValues(java.lang.String[] args)

This will take a String[] as an array of "-argument=value" pairs and add to/update the Hashtable containing the arguments.

Parameters:
args - String[] argument pairs to add/update


Copyright © 2001 Enhydra. All Rights Reserved.