| java.lang.Object com.anthonyeden.lib.config.ConfigurationBase
ConfigurationBase | public class ConfigurationBase implements MutableConfiguration(Code) | | The ConfigurationBase is a base implementation of the MutableConfiguration
interface.
author: Anthony Eden author: Florin T.PATRASCU |
Constructor Summary | |
public | ConfigurationBase(String name, Object value, Configuration parent) Construct a new ConfigurationBase object. | public | ConfigurationBase(String name, Object value, Configuration parent, Location location) Construct a new ConfigurationBase object. | public | ConfigurationBase(String name, Object value, List children, Map attributes, Configuration parent) Construct a new ConfigurationBase object. | public | ConfigurationBase(String name, Object value, List children, Map attributes, Configuration parent, Location location) Construct a new ConfigurationBase object. |
ConfigurationBase | public ConfigurationBase(String name, Object value, Configuration parent)(Code) | | Construct a new ConfigurationBase object.
Parameters: name - The configuration object name Parameters: value - The configuration object value Parameters: parent - The parent Configuration |
ConfigurationBase | public ConfigurationBase(String name, Object value, Configuration parent, Location location)(Code) | | Construct a new ConfigurationBase object.
Parameters: name - The configuration object name Parameters: value - The configuration object value Parameters: parent - The parent Configuration Parameters: location - The Location object or null |
ConfigurationBase | public ConfigurationBase(String name, Object value, List children, Map attributes, Configuration parent)(Code) | | Construct a new ConfigurationBase object.
Parameters: name - The configuration object name Parameters: value - The configuration object value Parameters: children - The List of children Parameters: attributes - The Map of attributes Parameters: parent - The parent Configuration |
ConfigurationBase | public ConfigurationBase(String name, Object value, List children, Map attributes, Configuration parent, Location location)(Code) | | Construct a new ConfigurationBase object.
Parameters: name - The configuration object name Parameters: value - The configuration object value Parameters: children - The List of children Parameters: attributes - The Map of attributes Parameters: parent - The parent Configuration Parameters: location - The Location or null |
addAttribute | public void addAttribute(String name, Object value)(Code) | | Add an attribute with the given name. The value's toString() method
will be used to convert the value to a String.
Parameters: name - The attribute name Parameters: value - The attribute value |
addChild | public MutableConfiguration addChild(String name)(Code) | | Add a child node with no child value to the configuration. This
method should be the same as calling
addChild(name, null)
Parameters: name - The name of the new configuration node The configuration node |
addChild | public MutableConfiguration addChild(String name, Object value)(Code) | | Add a child node to the configuration. The value's toString() method
will be used to convert the value to a String.
Parameters: name - The name of the new configuration node Parameters: value - The value of the new configuration node The configuration node |
addChild | public MutableConfiguration addChild(String name, Object value, Object defaultValue)(Code) | | Add a child node to the configuration. The value's toString() method
will be used to convert the value to a String. If the value is null use the
default value.
Parameters: name - The name of the new configuration node Parameters: value - The value of the new configuration node Parameters: defaultValue - value to use if the value was null The configuration node |
addChild | public void addChild(Configuration configuration)(Code) | | Add the configuration object as a child of this configuration object.
Parameters: configuration - The child configuration object |
clearChildren | public void clearChildren()(Code) | | Remove all of the children of this configuration node.
|
copy | public Configuration copy()(Code) | | This would be a deep copy if you used immutable objects such as Strings for values and attributes,
and shallow otherwise.
It clones the Location object, however it sets the parent to null.
copy of this Configuration |
copy | public Configuration copy(Configuration parentConfig)(Code) | | This would be a deep copy if you used immutable objects such as Strings for values and
attributes, and shallow otherwise. It clones the Location object, however it sets the
parent to null.
copy of this Configuration Parameters: parentConfig - |
getAttribute | public String getAttribute(String name)(Code) | | Get the named attribute or null.
Parameters: name - The attribute name The attribute value |
getAttribute | public String getAttribute(String name, String defaultValue)(Code) | | Get the named attribute. If the attribute is not found then
return the given default value.
Parameters: name - The attribute name Parameters: defaultValue - The default value The attribute value |
getAttributeNames | public List getAttributeNames()(Code) | | Get a List of attribute names.
A List of attribute names |
getChild | public Configuration getChild(String name)(Code) | | 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 The first named child or null |
getChildValue | public String getChildValue(String name)(Code) | | 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 The value or null |
getChildValue | public String getChildValue(String name, String defaultValue)(Code) | | 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 Parameters: defaultValue - The default value The value |
getChildren | public List getChildren()(Code) | | Get a list of all child nodes.
A List of Configuration objects |
getChildren | public List getChildren(String name)(Code) | | Get a list of all child nodes with the given name.
Parameters: name - The child node name A List of Configuration objects |
getLocation | public Location getLocation()(Code) | | Get location information for this configuration object.
Location |
getName | public String getName()(Code) | | Get the node's name.
The node's name |
getParent | public Configuration getParent()(Code) | | Get the parent configuration object. This method will return null
if this configuration object is the top-most configuration object
in the configuration tree.
The parent configuration object or null |
getValue | public String getValue()(Code) | | Get the node's value or null if the node contains no data.
The node value or null |
getValue | public String getValue(String defaultValue)(Code) | | Get the node's value. If the node contains no data then return
the given default value.
Parameters: defaultValue - The default value The node value |
removeChild | public void removeChild(Configuration configuration)(Code) | | Remove the specified configuration object.
Parameters: configuration - The child configuration object |
setName | public void setName(String name)(Code) | | Set the node name.
Parameters: name - The new node name |
setValue | public void setValue(String value)(Code) | | Set the configuration object's value.
Parameters: value - The new value |
write | void write(Configuration configuration, XMLOutputter xmlOut) throws IOException(Code) | | Write the given Configuration object to the XMLOutputter. This method
is recursive and will call itself until all children are printed.
Parameters: configuration - The Configuration object Parameters: xmlOut - The XMLOutputter throws: IOException - |
|
|