org.apache.slide.util.conf
Interface Configuration

All Known Implementing Classes:
AbstractConfiguration

public interface Configuration

Configuration is a interface encapsulating a configuration node used to retrieve configuration values. This is a "read only" interface preventing applications from modifying their own configurations.
The contract surrounding the Configuration is that once it is created, information never changes. The Configuration is built by the SAXConfigurationBuilder and the ConfigurationImpl helper classes.

Version:
1.1.0, 22/05/1999.

Method Summary
 java.lang.String getAttribute(java.lang.String paramName)
          Return the value of specified attribute.
 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, or the default value if no attribute by that name exists or is empty.
 boolean getAttributeAsBoolean(java.lang.String paramName)
          Return the boolean value of the specified parameter contained in this node.
 boolean getAttributeAsBoolean(java.lang.String name, boolean defaultValue)
          Returns the value of the attribute specified by its name as a boolean, or the default value if no attribute by that name exists or is empty.
 float getAttributeAsFloat(java.lang.String paramName)
          Return the float value of the specified parameter contained in this node.
 float getAttributeAsFloat(java.lang.String name, float defaultValue)
          Returns the value of the attribute specified by its name as a float, or the default value if no attribute by that name exists or is empty.
 int getAttributeAsInt(java.lang.String paramName)
          Return the int value of the specified attribute contained in this node.
 int getAttributeAsInt(java.lang.String name, int defaultValue)
          Returns the value of the attribute specified by its name as a int, or the default value if no attribute by that name exists or is empty.
 long getAttributeAsLong(java.lang.String paramName)
          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, or the default value if no attribute by that name exists or is empty.
 Configuration getConfiguration(java.lang.String child)
          Return a new Configuration instance encapsulating the specified child node.
 java.util.Enumeration getConfigurations(java.lang.String name)
          Return an Enumeration of Configuration elements containing all node children with the specified name.
 java.lang.String getLocation()
          Return a String indicating the position of this configuration element in a source file or URI.
 java.lang.String getName()
          Return the name of the node.
 java.lang.String getValue()
          Return the String value of the node.
 java.lang.String getValue(java.lang.String defaultValue)
          Returns the value of the configuration element as a String.
 boolean getValueAsBoolean()
          Return the boolean value of the node.
 boolean getValueAsBoolean(boolean defaultValue)
          Returns the value of the configuration element as a boolean.
 float getValueAsFloat()
          Return the float value of the node.
 float getValueAsFloat(float defaultValue)
          Returns the value of the configuration element as a float.
 int getValueAsInt()
          Return the int value of the node.
 int getValueAsInt(int defaultValue)
          Returns the value of the configuration element as an int.
 long getValueAsLong()
          Return the long value of the node.
 long getValueAsLong(long defaultValue)
          Returns the value of the configuration element as a long.
 

Method Detail

getName

public java.lang.String getName()
Return the name of the node.

Returns:
name of the Configuration node.

getConfiguration

public Configuration getConfiguration(java.lang.String child)
                               throws ConfigurationException
Return a new Configuration instance encapsulating the specified child node.

Parameters:
child - The name of the child node.
Returns:
Configuration
Throws:
ConfigurationException - If no child with that name exists.

getConfigurations

public java.util.Enumeration getConfigurations(java.lang.String name)
Return an Enumeration of Configuration elements containing all node children with the specified name.

Parameters:
name - The name of the children to get.
Returns:
Enumeration. The Enumeration will be empty if there are no nodes by the specified name.

getAttribute

public java.lang.String getAttribute(java.lang.String paramName)
                              throws ConfigurationException
Return the value of specified attribute.

Parameters:
paramName - The name of the parameter you ask the value of.
Returns:
String value of attribute.
Throws:
ConfigurationException - If no attribute with that name exists.

getAttributeAsInt

public int getAttributeAsInt(java.lang.String paramName)
                      throws ConfigurationException
Return the int value of the specified attribute contained in this node.

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.

getAttributeAsLong

public long getAttributeAsLong(java.lang.String paramName)
                        throws ConfigurationException
Returns the value of the attribute specified by its name as a long.

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.

getAttributeAsFloat

public float getAttributeAsFloat(java.lang.String paramName)
                          throws ConfigurationException
Return the float value of the specified parameter contained in this node.

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.

getAttributeAsBoolean

public boolean getAttributeAsBoolean(java.lang.String paramName)
                              throws ConfigurationException
Return the boolean value of the specified parameter contained in this node.

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.

getValue

public java.lang.String getValue()
Return the String value of the node.

Returns:
the value of the node.

getValueAsInt

public int getValueAsInt()
                  throws ConfigurationException
Return the int value of the node.

Returns:
the value of the node.
Throws:
ConfigurationException - If conversion to int fails

getValueAsFloat

public float getValueAsFloat()
                      throws ConfigurationException
Return the float value of the node.

Returns:
the value of the node.
Throws:
ConfigurationException - If conversion to float fails.

getValueAsBoolean

public boolean getValueAsBoolean()
                          throws ConfigurationException
Return the boolean value of the node.

Returns:
the value of the node.
Throws:
ConfigurationException - If conversion to boolean fails.

getValueAsLong

public long getValueAsLong()
                    throws ConfigurationException
Return the long value of the node.

Returns:
the value of the node.
Throws:
ConfigurationException - If conversion to long fails.

getValue

public java.lang.String getValue(java.lang.String defaultValue)
Returns the value of the configuration element as a String. If the configuration value is not set, the default value will be used.

Parameters:
defaultValue - The default value desired.
Returns:
String value of the Configuration, or default if none specified.

getValueAsInt

public int getValueAsInt(int defaultValue)
Returns the value of the configuration element as an int. If the configuration value is not set, the default value will be used.

Parameters:
defaultValue - The default value desired.
Returns:
int value of the Configuration, or default if none specified.

getValueAsLong

public long getValueAsLong(long defaultValue)
Returns the value of the configuration element as a long. If the configuration value is not set, the default value will be used.

Parameters:
defaultValue - The default value desired.
Returns:
long value of the Configuration, or default if none specified.

getValueAsFloat

public float getValueAsFloat(float defaultValue)
Returns the value of the configuration element as a float. If the configuration value is not set, the default value will be used.

Parameters:
defaultValue - The default value desired.
Returns:
float value of the Configuration, or default if none specified.

getValueAsBoolean

public boolean getValueAsBoolean(boolean defaultValue)
Returns the value of the configuration element as a boolean. If the configuration value is not set, the default value will be used.

Parameters:
defaultValue - The default value desired.
Returns:
boolean value of the Configuration, or default if none specified.

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, or the default value if no attribute by that name exists or is empty.

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.

getAttributeAsInt

public int getAttributeAsInt(java.lang.String name,
                             int defaultValue)
Returns the value of the attribute specified by its name as a int, or the default value if no attribute by that name exists or is empty.

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,
                               long defaultValue)
Returns the value of the attribute specified by its name as a long, or the default value if no attribute by that name exists or is empty.

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,
                                 float defaultValue)
Returns the value of the attribute specified by its name as a float, or the default value if no attribute by that name exists or is empty.

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,
                                     boolean defaultValue)
Returns the value of the attribute specified by its name as a boolean, or the default value if no attribute by that name exists or is empty.

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.

getLocation

public java.lang.String getLocation()
Return a String indicating the position of this configuration element in a source file or URI.

Returns:
String if a source file or URI is specified. Otherwise it returns null