org.apache.avalon.framework.configuration
Class AbstractConfiguration

java.lang.Object
  |
  +--org.apache.avalon.framework.configuration.AbstractConfiguration
All Implemented Interfaces:
Configuration
Direct Known Subclasses:
DefaultConfiguration

public abstract class AbstractConfiguration
extends java.lang.Object
implements Configuration

This is an abstract Configuration implementation that deals with methods that can be abstracted away from underlying implementations.

Version:
CVS $Revision: 1.1 $ $Date: 2001/04/26 14:16:25 $
Author:
Federico Barbieri, Stefano Mazzocchi, Peter Donald, Pierpaolo Fumagalli

Constructor Summary
AbstractConfiguration()
           
 
Method Summary
 java.lang.String getAttribute(java.lang.String name, java.lang.String defaultValue)
          Returns the value of the attribute specified by its name as a String.
 boolean getAttributeAsBoolean(java.lang.String name)
          Returns the value of the attribute specified by its name as a boolean.
 boolean getAttributeAsBoolean(java.lang.String name, boolean defaultValue)
          Returns the value of the attribute specified by its name as a boolean.
 float getAttributeAsFloat(java.lang.String name)
          Returns the value of the attribute specified by its name as a float.
 float getAttributeAsFloat(java.lang.String name, float defaultValue)
          Returns the value of the attribute specified by its name as a float.
 int getAttributeAsInteger(java.lang.String name)
          Returns the value of the attribute specified by its name as an int.
 int getAttributeAsInteger(java.lang.String name, int defaultValue)
          Returns the value of the attribute specified by its name as an int.
 long getAttributeAsLong(java.lang.String name)
          Returns the value of the attribute specified by its name as a long.
 long getAttributeAsLong(java.lang.String name, long defaultValue)
          Returns the value of the attribute specified by its name as a long.
 Configuration getChild(java.lang.String name)
          Return the first Configuration object child of this associated with the given name.
 Configuration getChild(java.lang.String name, boolean createNew)
          Return the first Configuration object child of this associated with the given name.
 java.lang.String getValue(java.lang.String defaultValue)
          Returns the value of the configuration element as a String.
 boolean getValueAsBoolean()
          Returns the value of the configuration element as a boolean.
 boolean getValueAsBoolean(boolean defaultValue)
          Returns the value of the configuration element as a boolean.
 float getValueAsFloat()
          Returns the value of the configuration element as a float.
 float getValueAsFloat(float defaultValue)
          Returns the value of the configuration element as a float.
 int getValueAsInteger()
          Returns the value of the configuration element as an int.
 int getValueAsInteger(int defaultValue)
          Returns the value of the configuration element as an int.
 long getValueAsLong()
          Returns the value of the configuration element as a long.
 long getValueAsLong(long defaultValue)
          Returns the value of the configuration element as a long.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.avalon.framework.configuration.Configuration
getAttribute, getAttributeNames, getChildren, getChildren, getLocation, getName, getValue
 

Constructor Detail

AbstractConfiguration

public AbstractConfiguration()
Method Detail

getValueAsInteger

public int getValueAsInteger()
                      throws ConfigurationException
Returns the value of the configuration element as an int.
Specified by:
getValueAsInteger in interface Configuration
Following copied from interface: org.apache.avalon.framework.configuration.Configuration
Throws:
ConfigurationException - If conversion to int fails.

getValueAsInteger

public int getValueAsInteger(int defaultValue)
Returns the value of the configuration element as an int.
Specified by:
getValueAsInteger in interface Configuration
Following copied from interface: org.apache.avalon.framework.configuration.Configuration
Parameters:
defaultValue - The default value desired.
Returns:
int value of the Configuration, or default if none specified.

getValueAsLong

public long getValueAsLong()
                    throws ConfigurationException
Returns the value of the configuration element as a long.
Specified by:
getValueAsLong in interface Configuration
Following copied from interface: org.apache.avalon.framework.configuration.Configuration
Returns:
the value of the node.
Throws:
ConfigurationException - If conversion to long fails.

getValueAsLong

public long getValueAsLong(long defaultValue)
Returns the value of the configuration element as a long.
Specified by:
getValueAsLong in interface Configuration
Following copied from interface: org.apache.avalon.framework.configuration.Configuration
Parameters:
defaultValue - The default value desired.
Returns:
long value of the Configuration, or default if none specified.

getValueAsFloat

public float getValueAsFloat()
                      throws ConfigurationException
Returns the value of the configuration element as a float.
Specified by:
getValueAsFloat in interface Configuration
Following copied from interface: org.apache.avalon.framework.configuration.Configuration
Returns:
the value of the node.
Throws:
ConfigurationException - If conversion to float fails.

getValueAsFloat

public float getValueAsFloat(float defaultValue)
Returns the value of the configuration element as a float.
Specified by:
getValueAsFloat in interface Configuration
Following copied from interface: org.apache.avalon.framework.configuration.Configuration
Parameters:
defaultValue - The default value desired.
Returns:
float value of the Configuration, or default if none specified.

getValueAsBoolean

public boolean getValueAsBoolean()
                          throws ConfigurationException
Returns the value of the configuration element as a boolean.
Specified by:
getValueAsBoolean in interface Configuration
Following copied from interface: org.apache.avalon.framework.configuration.Configuration
Returns:
the value of the node.
Throws:
ConfigurationException - If conversion to boolean fails.

getValueAsBoolean

public boolean getValueAsBoolean(boolean defaultValue)
Returns the value of the configuration element as a boolean.
Specified by:
getValueAsBoolean in interface Configuration
Following copied from interface: org.apache.avalon.framework.configuration.Configuration
Parameters:
defaultValue - The default value desired.
Returns:
boolean value of the Configuration, or default if none specified.

getValue

public java.lang.String getValue(java.lang.String defaultValue)
Returns the value of the configuration element as a String.
Specified by:
getValue in interface Configuration
Following copied from interface: org.apache.avalon.framework.configuration.Configuration
Parameters:
defaultValue - The default value desired.
Returns:
String value of the Configuration, or default if none specified.

getAttributeAsInteger

public int getAttributeAsInteger(java.lang.String name)
                          throws ConfigurationException
Returns the value of the attribute specified by its name as an int.
Specified by:
getAttributeAsInteger in interface Configuration
Following copied from interface: org.apache.avalon.framework.configuration.Configuration
Parameters:
paramName - The name of the parameter you ask the value of.
Returns:
int value of attribute
Throws:
ConfigurationException - If no parameter with that name exists. or if conversion to int fails.

getAttributeAsInteger

public int getAttributeAsInteger(java.lang.String name,
                                 int defaultValue)
Returns the value of the attribute specified by its name as an int.
Specified by:
getAttributeAsInteger in interface Configuration
Following copied from interface: org.apache.avalon.framework.configuration.Configuration
Parameters:
name - The name of the attribute you ask the value of.
defaultValue - The default value desired.
Returns:
int value of attribute. It will return the default value if the named attribute does not exist, or if the value is not set.

getAttributeAsLong

public long getAttributeAsLong(java.lang.String name)
                        throws ConfigurationException
Returns the value of the attribute specified by its name as a long.
Specified by:
getAttributeAsLong in interface Configuration
Following copied from interface: org.apache.avalon.framework.configuration.Configuration
Parameters:
paramName - The name of the parameter you ask the value of.
Returns:
long value of attribute
Throws:
ConfigurationException - If no parameter with that name exists. or if conversion to long fails.

getAttributeAsLong

public long getAttributeAsLong(java.lang.String name,
                               long defaultValue)
Returns the value of the attribute specified by its name as a long.
Specified by:
getAttributeAsLong in interface Configuration
Following copied from interface: org.apache.avalon.framework.configuration.Configuration
Parameters:
name - The name of the attribute you ask the value of.
defaultValue - The default value desired.
Returns:
long value of attribute. It will return the default value if the named attribute does not exist, or if the value is not set.

getAttributeAsFloat

public float getAttributeAsFloat(java.lang.String name)
                          throws ConfigurationException
Returns the value of the attribute specified by its name as a float.
Specified by:
getAttributeAsFloat in interface Configuration
Following copied from interface: org.apache.avalon.framework.configuration.Configuration
Parameters:
paramName - The name of the parameter you ask the value of.
Returns:
float value of attribute
Throws:
ConfigurationException - If no parameter with that name exists. or if conversion to float fails.

getAttributeAsFloat

public float getAttributeAsFloat(java.lang.String name,
                                 float defaultValue)
Returns the value of the attribute specified by its name as a float.
Specified by:
getAttributeAsFloat in interface Configuration
Following copied from interface: org.apache.avalon.framework.configuration.Configuration
Parameters:
name - The name of the attribute you ask the value of.
defaultValue - The default value desired.
Returns:
float value of attribute. It will return the default value if the named attribute does not exist, or if the value is not set.

getAttributeAsBoolean

public boolean getAttributeAsBoolean(java.lang.String name)
                              throws ConfigurationException
Returns the value of the attribute specified by its name as a boolean.
Specified by:
getAttributeAsBoolean in interface Configuration
Following copied from interface: org.apache.avalon.framework.configuration.Configuration
Parameters:
paramName - The name of the parameter you ask the value of.
Returns:
boolean value of attribute
Throws:
ConfigurationException - If no parameter with that name exists. or if conversion to boolean fails.

getAttributeAsBoolean

public boolean getAttributeAsBoolean(java.lang.String name,
                                     boolean defaultValue)
Returns the value of the attribute specified by its name as a boolean.
Specified by:
getAttributeAsBoolean in interface Configuration
Following copied from interface: org.apache.avalon.framework.configuration.Configuration
Parameters:
name - The name of the attribute you ask the value of.
defaultValue - The default value desired.
Returns:
boolean value of attribute. It will return the default value if the named attribute does not exist, or if the value is not set.

getAttribute

public java.lang.String getAttribute(java.lang.String name,
                                     java.lang.String defaultValue)
Returns the value of the attribute specified by its name as a String.
Specified by:
getAttribute in interface Configuration
Following copied from interface: org.apache.avalon.framework.configuration.Configuration
Parameters:
name - The name of the attribute you ask the value of.
defaultValue - The default value desired.
Returns:
String value of attribute. It will return the default value if the named attribute does not exist, or if the value is not set.

getChild

public Configuration getChild(java.lang.String name)
Return the first Configuration object child of this associated with the given name.
Specified by:
getChild in interface Configuration
Following copied from interface: org.apache.avalon.framework.configuration.Configuration
Parameters:
child - The name of the child node.
Returns:
Configuration

getChild

public Configuration getChild(java.lang.String name,
                              boolean createNew)
Return the first Configuration object child of this associated with the given name.
Specified by:
getChild in interface Configuration
Following copied from interface: org.apache.avalon.framework.configuration.Configuration
Parameters:
child - The name of the child node.
Returns:
Configuration


Copyright © 2001 Apache Jakarta Project. All Rights Reserved.