org.codehaus.plexus.configuration

## Class DefaultPlexusConfiguration

- java.lang.Object
- - org.codehaus.plexus.configuration.DefaultPlexusConfiguration

All Implemented Interfaces:
  PlexusConfiguration

Direct Known Subclasses:
  XmlPlexusConfiguration

    public class DefaultPlexusConfiguration
    extends java.lang.Object
    implements PlexusConfiguration

Version:
  $Id: DefaultPlexusConfiguration.java 7854 2008-11-18 22:33:53Z bentmann $

### Constructor Summary

Constructors
`protected` `DefaultPlexusConfiguration()`
`protected` `DefaultPlexusConfiguration(java.lang.String name)`
`protected` `DefaultPlexusConfiguration(java.lang.String name, java.lang.String value)`

### Method Summary

Methods
`void` `addChild(PlexusConfiguration child)` Adds a configuration under this configuration, which acts as a parent.
`PlexusConfiguration` `addChild(java.lang.String name)` Add a child element with a given name and return the newly created element.
`PlexusConfiguration` `addChild(java.lang.String name, java.lang.String value)` Add a child element with a given name, and given value and return the newly created element.
`java.lang.String` `getAttribute(java.lang.String name)` Returns the value of the named attribute.
`java.lang.String` `getAttribute(java.lang.String name, java.lang.String defaultValue)` Returns the value of the named attribute, or default if one cannot be found.
`java.lang.String[]` `getAttributeNames()` Returns an array of attribute names.
`PlexusConfiguration` `getChild(int i)` Returns the child configuration at the given location.
`PlexusConfiguration` `getChild(java.lang.String name)` Returns the child configuration of the given name.
`PlexusConfiguration` `getChild(java.lang.String name, boolean createChild)` Returns the child configuration of the given name.
`int` `getChildCount()` Returns the number of directly children under this configuration.
`PlexusConfiguration[]` `getChildren()` Returns an array of all child configurations.
`PlexusConfiguration[]` `getChildren(java.lang.String name)` Returns an array of all child configurations with the given name.
`java.lang.String` `getName()` Returns the name of this configuration.
`java.lang.String` `getValue()` Returns the value of this configuration.
`java.lang.String` `getValue(java.lang.String defaultValue)` Returns the value of this configuration, or default if one cannot be found.
`void` `setAttribute(java.lang.String name, java.lang.String value)` Sets an attribute on this configuration.
`void` `setName(java.lang.String name)` Sets the name of this configuration.
`void` `setValue(java.lang.String val)` Set the value of a configuration element.
`PlexusConfiguration` `setValueAndGetSelf(java.lang.String val)` Set the value of a configuration element and return the PlexusConfiguration object so that further operations can be carried out.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### DefaultPlexusConfiguration

    protected DefaultPlexusConfiguration()

#### DefaultPlexusConfiguration

    protected DefaultPlexusConfiguration(java.lang.String name)

#### DefaultPlexusConfiguration

    protected DefaultPlexusConfiguration(java.lang.String name,
                              java.lang.String value)

### Method Detail

#### getName

    public java.lang.String getName()

Description copied from interface: `PlexusConfiguration`
Returns the name of this configuration.

Specified by:
  `getName` in interface `PlexusConfiguration`
Returns:
  the name of this configuration

#### setName

    public void setName(java.lang.String name)

Description copied from interface: `PlexusConfiguration`
Sets the name of this configuration.

Specified by:
  `setName` in interface `PlexusConfiguration`

#### getValue

    public java.lang.String getValue()

Description copied from interface: `PlexusConfiguration`
Returns the value of this configuration.

Specified by:
  `getValue` in interface `PlexusConfiguration`
Returns:
  the value of this configuration

#### getValue

    public java.lang.String getValue(java.lang.String defaultValue)

Description copied from interface: `PlexusConfiguration`
Returns the value of this configuration, or default if one cannot be found.

Specified by:
  `getValue` in interface `PlexusConfiguration`
Parameters:
  `defaultValue` - value to return if none is found
Returns:
  the value of this configuration

#### setValue

    public void setValue(java.lang.String val)

Description copied from interface: `PlexusConfiguration`
Set the value of a configuration element.

Specified by:
  `setValue` in interface `PlexusConfiguration`

#### setValueAndGetSelf

    public PlexusConfiguration setValueAndGetSelf(java.lang.String val)

Description copied from interface: `PlexusConfiguration`
Set the value of a configuration element and return the PlexusConfiguration object so that further operations can be carried out.

Specified by:
  `setValueAndGetSelf` in interface `PlexusConfiguration`
Returns:

#### setAttribute

    public void setAttribute(java.lang.String name,
                    java.lang.String value)

Description copied from interface: `PlexusConfiguration`
Sets an attribute on this configuration.

Specified by:
  `setAttribute` in interface `PlexusConfiguration`

#### getAttribute

    public java.lang.String getAttribute(java.lang.String name)

Description copied from interface: `PlexusConfiguration`
Returns the value of the named attribute.

Specified by:
  `getAttribute` in interface `PlexusConfiguration`
Returns:
  the value of the named attribute

#### getAttribute

    public java.lang.String getAttribute(java.lang.String name,
                                java.lang.String defaultValue)

Description copied from interface: `PlexusConfiguration`
Returns the value of the named attribute, or default if one cannot be found.

Specified by:
  `getAttribute` in interface `PlexusConfiguration`
  `defaultValue` - value to return if none is found
Returns:
  the value of the named attribute

#### getAttributeNames

    public java.lang.String[] getAttributeNames()

Description copied from interface: `PlexusConfiguration`
Returns an array of attribute names.

Specified by:
  `getAttributeNames` in interface `PlexusConfiguration`
Returns:
  an array of attribute names

#### getChild

    public PlexusConfiguration getChild(java.lang.String name)

Description copied from interface: `PlexusConfiguration`
Returns the child configuration of the given name.

Specified by:
  `getChild` in interface `PlexusConfiguration`
Parameters:
  `name` - the name of the child to return
Returns:
  the child configuration of the given name

#### getChild

    public PlexusConfiguration getChild(int i)

Description copied from interface: `PlexusConfiguration`
Returns the child configuration at the given location.

Specified by:
  `getChild` in interface `PlexusConfiguration`
Parameters:
  `i` - the position of the child under this configuration
Returns:
  the child configuration at the given location

#### getChild

    public PlexusConfiguration getChild(java.lang.String name,
                               boolean createChild)

Description copied from interface: `PlexusConfiguration`
Returns the child configuration of the given name.

Specified by:
  `getChild` in interface `PlexusConfiguration`
Parameters:
  `name` - the name of the child to return
  `createChild` - true if a new child should be create, if none found
Returns:
  the child configuration of the given name, or new child if created

#### getChildren

    public PlexusConfiguration[] getChildren()

Description copied from interface: `PlexusConfiguration`
Returns an array of all child configurations.

Specified by:
  `getChildren` in interface `PlexusConfiguration`
Returns:
  an array of all child configurations

#### getChildren

    public PlexusConfiguration[] getChildren(java.lang.String name)

Description copied from interface: `PlexusConfiguration`
Returns an array of all child configurations with the given name.

Specified by:
  `getChildren` in interface `PlexusConfiguration`
Parameters:
  `name` - the name of the children configurations to return
Returns:
  an array of all child configurations with the given name

#### addChild

    public void addChild(PlexusConfiguration child)

Description copied from interface: `PlexusConfiguration`
Adds a configuration under this configuration, which acts as a parent.

Specified by:
  `addChild` in interface `PlexusConfiguration`
Parameters:
  `child` - the child configuration to add

#### addChild

    public PlexusConfiguration addChild(java.lang.String name)

Description copied from interface: `PlexusConfiguration`
Add a child element with a given name and return the newly created element.

Specified by:
  `addChild` in interface `PlexusConfiguration`
Returns:

#### addChild

    public PlexusConfiguration addChild(java.lang.String name,
                               java.lang.String value)

Description copied from interface: `PlexusConfiguration`
Add a child element with a given name, and given value and return the newly created element.

Specified by:
  `addChild` in interface `PlexusConfiguration`
Returns:

#### getChildCount

    public int getChildCount()

Description copied from interface: `PlexusConfiguration`
Returns the number of directly children under this configuration.

Specified by:
  `getChildCount` in interface `PlexusConfiguration`
Returns:
  the number of directly children under this configuration.