org.apache.avalon.framework.parameters
Class Parameters

java.lang.Object
  |
  +--org.apache.avalon.framework.parameters.Parameters

public class Parameters
extends java.lang.Object

Author:
Pierpaolo Fumagalli

Constructor Summary
Parameters()
           
 
Method Summary
static Parameters fromConfiguration(Configuration configuration)
          Create a Parameters object from a Configuration object.
static Parameters fromProperties(java.util.Properties properties)
          Create a Parameters object from a Properties object.
 java.lang.String getParameter(java.lang.String name, java.lang.String defaultValue)
          Retrieve the String value of the specified parameter.
 boolean getParameterAsBoolean(java.lang.String name, boolean defaultValue)
          Retrieve the boolean value of the specified parameter.
 float getParameterAsFloat(java.lang.String name, float defaultValue)
          Retrieve the float value of the specified parameter.
 int getParameterAsInteger(java.lang.String name, int defaultValue)
          Retrieve the int value of the specified parameter.
 long getParameterAsLong(java.lang.String name, long defaultValue)
          Retrieve the long value of the specified parameter.
 java.util.Iterator getParameterNames()
          Return an Enumeration view of all parameter names.
 boolean isParameter(java.lang.String name)
          Check if the specified parameter can be retrieved.
 Parameters merge(Parameters other)
          Merge parameters from another Parameters instance into this.
 java.lang.String setParameter(java.lang.String name, java.lang.String value)
          Set the String value of a specified parameter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Parameters

public Parameters()
Method Detail

setParameter

public java.lang.String setParameter(java.lang.String name,
                                     java.lang.String value)
Set the String value of a specified parameter.

If the specified value is null the parameter is removed.

Returns:
The previous value of the parameter or null.

getParameterNames

public java.util.Iterator getParameterNames()
Return an Enumeration view of all parameter names.

isParameter

public boolean isParameter(java.lang.String name)
Check if the specified parameter can be retrieved.

getParameter

public java.lang.String getParameter(java.lang.String name,
                                     java.lang.String defaultValue)
Retrieve the String value of the specified parameter.

If the specified parameter cannot be found, defaultValue is returned.


getParameterAsInteger

public int getParameterAsInteger(java.lang.String name,
                                 int defaultValue)
Retrieve the int value of the specified parameter.

If the specified parameter cannot be found, defaultValue is returned.


getParameterAsLong

public long getParameterAsLong(java.lang.String name,
                               long defaultValue)
Retrieve the long value of the specified parameter.

If the specified parameter cannot be found, defaultValue is returned.


getParameterAsFloat

public float getParameterAsFloat(java.lang.String name,
                                 float defaultValue)
Retrieve the float value of the specified parameter.

If the specified parameter cannot be found, defaultValue is returned.


getParameterAsBoolean

public boolean getParameterAsBoolean(java.lang.String name,
                                     boolean defaultValue)
Retrieve the boolean value of the specified parameter.

If the specified parameter cannot be found, defaultValue is returned.


merge

public Parameters merge(Parameters other)
Merge parameters from another Parameters instance into this.
Returns:
This Parameters instance.

fromConfiguration

public static Parameters fromConfiguration(Configuration configuration)
                                    throws ConfigurationException
Create a Parameters object from a Configuration object.

fromProperties

public static Parameters fromProperties(java.util.Properties properties)
Create a Parameters object from a Properties object.


Copyright © 2001 Apache Jakarta Project. All Rights Reserved.