com.anthonyeden.lib.config
Interface Configuration

All Known Subinterfaces:
MutableConfiguration
All Known Implementing Classes:
ConfigurationBase

public interface Configuration

The Configuration interface represents a node in a configuration tree.

Author:
Anthony Eden

Method Summary
 java.lang.String getAttribute(java.lang.String name)
          Get the named attribute or null.
 java.lang.String getAttribute(java.lang.String name, java.lang.String defaultValue)
          Get the named attribute.
 java.util.List getAttributeNames()
          Get a List of attribute names.
 Configuration getChild(java.lang.String name)
          Get the child configuration object with the given name.
 java.util.List getChildren()
          Get a list of all child nodes.
 java.util.List getChildren(java.lang.String name)
          Get a list of all child nodes with the given name.
 java.lang.String getChildValue(java.lang.String name)
          Get the value of the first child configuration object with the given name.
 java.lang.String getChildValue(java.lang.String name, java.lang.String defaultValue)
          Get the value of the first child configuration object with the given name.
 Location getLocation()
          Get location information for this configuration object.
 java.lang.String getName()
          Get the node's name.
 Configuration getParent()
          Get the parent configuration object.
 java.lang.String getValue()
          Get the node's value or null if the node contains no data.
 java.lang.String getValue(java.lang.String defaultValue)
          Get the node's value.
 

Method Detail

getName

public java.lang.String getName()
Get the node's name.

Returns:
The node's name

getParent

public Configuration getParent()
Get the parent configuration object. This method will return null if this configuration object is the top-most configuration object in the configuration tree.

Returns:
The parent configuration object or null

getChild

public Configuration getChild(java.lang.String name)
Get the child configuration object with the given name. If the child with the name does not exist then this method returns null. If more than one child with the given name exists then this method returns the first child.

Parameters:
name - The child name
Returns:
The first named child or null

getChildValue

public java.lang.String getChildValue(java.lang.String name)
Get the value of the first child configuration object with the given name. If the child cannot be found or the child had no data then this method returns null.

Parameters:
name - The child name
Returns:
The value or null

getChildValue

public java.lang.String getChildValue(java.lang.String name,
                                      java.lang.String defaultValue)
Get the value of the first child configuration object with the given name. If the child cannot be found or the child had no data then this method returns the given default value.

Parameters:
name - The child name
defaultValue - The default value
Returns:
The value

getChildren

public java.util.List getChildren()
Get a list of all child nodes.

Returns:
A List of Configuration objects

getChildren

public java.util.List getChildren(java.lang.String name)
Get a list of all child nodes with the given name.

Parameters:
name - The child node name
Returns:
A List of Configuration objects

getAttributeNames

public java.util.List getAttributeNames()
Get a List of attribute names.

Returns:
A List of attribute names

getAttribute

public java.lang.String getAttribute(java.lang.String name)
Get the named attribute or null.

Parameters:
name - The attribute name
Returns:
The attribute value

getAttribute

public java.lang.String getAttribute(java.lang.String name,
                                     java.lang.String defaultValue)
Get the named attribute. If the attribute is not found then return the given default value.

Parameters:
name - The attribute name
defaultValue - The default value
Returns:
The attribute value

getValue

public java.lang.String getValue()
Get the node's value or null if the node contains no data.

Returns:
The node value or null

getValue

public java.lang.String getValue(java.lang.String defaultValue)
Get the node's value. If the node contains no data then return the given default value.

Parameters:
defaultValue - The default value
Returns:
The node value

getLocation

public Location getLocation()
Get location information for this configuration object.

Returns:
Location


Copyright (c) 2000-2003 Anthony Eden. All Rights Reserved.