/* Copyright (c) 2001 Oracle Corporation. All Rights Reserved. */
package oracle.portal.utils.v1;

import java.util.*;

/**
 * A <code>ParameterMap</code> contains a set of parameters whose values
 * are <code>Object</code>s mapped to <code>String</code> names.
 */
public class SimpleParameterMap implements ParameterMap
{

    /**
     * Gets the value of the parameter with the given name. If either the name
     * or parameter does not exist, null is returned.
     *
     * @param parameterName the parameter name.
     * @return the parameter with given name.
     */
    public Object getParameterValue(String parameterName)
    {
        return mParams.get(parameterName);
    }

    /**
     * Adds the specified parameter.
     *
     * @param paramName the parameter name.
     * @param paramValue the parameter value.
     */
    public void putParameterValue(String paramName, Object paramValue)
    {
        mParams.put(paramName, paramValue);
    }

    /**
     * Returns an <code>Enumeration</code> of the parameter names belonging to
     * this <code>ParameterMap</code> object, this may then be used to fetch
     * the parameters sequentially.
     *
     * @return an <code>Enumeration</code> of the parameter names.
     */
    public Enumeration getParameterNames()
    {
        return mParams.keys();
    }

    /**
     * Returns true if this <code>ParameterMap</code> object contains the
     * specified String as a parameter name.
     *
     * @param parameterName parameter name to search for.
     * @return true if the give name is found, false otherwise.
     */
    public boolean containsParameter(String parameterName)
    {
        return mParams.containsKey(parameterName);
    }


    private Hashtable mParams = new Hashtable(5);
}
