Class DefaultPlexusConfiguration
- java.lang.Object
-
- org.codehaus.plexus.configuration.DefaultPlexusConfiguration
-
- All Implemented Interfaces:
PlexusConfiguration
- Direct Known Subclasses:
XmlPlexusConfiguration
public class DefaultPlexusConfiguration extends Object implements PlexusConfiguration
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
DefaultPlexusConfiguration()
protected
DefaultPlexusConfiguration(String name)
protected
DefaultPlexusConfiguration(String name, String value)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PlexusConfiguration
addChild(String name)
Add a child element with a given name and return the newly created element.PlexusConfiguration
addChild(String name, String value)
Add a child element with a given name, and given value and return the newly created element.void
addChild(PlexusConfiguration child)
Adds a configuration under this configuration, which acts as a parent.String
getAttribute(String name)
Returns the value of the named attribute.String
getAttribute(String name, String defaultValue)
Returns the value of the named attribute, or default if one cannot be found.String[]
getAttributeNames()
Returns an array of attribute names.PlexusConfiguration
getChild(int i)
Returns the child configuration at the given location.PlexusConfiguration
getChild(String name)
Returns the child configuration of the given name.PlexusConfiguration
getChild(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(String name)
Returns an array of all child configurations with the given name.String
getName()
Returns the name of this configuration.String
getValue()
Returns the value of this configuration.String
getValue(String defaultValue)
Returns the value of this configuration, or default if one cannot be found.void
setAttribute(String name, String value)
Sets an attribute on this configuration.void
setName(String name)
Sets the name of this configuration.void
setValue(String val)
Set the value of a configuration element.PlexusConfiguration
setValueAndGetSelf(String val)
Set the value of a configuration element and return the PlexusConfiguration object so that further operations can be carried out.
-
-
-
Method Detail
-
getName
public String getName()
Description copied from interface:PlexusConfiguration
Returns the name of this configuration.- Specified by:
getName
in interfacePlexusConfiguration
- Returns:
- the name of this configuration
-
setName
public void setName(String name)
Description copied from interface:PlexusConfiguration
Sets the name of this configuration.- Specified by:
setName
in interfacePlexusConfiguration
- Parameters:
name
- The name of the configuration.
-
getValue
public String getValue()
Description copied from interface:PlexusConfiguration
Returns the value of this configuration.- Specified by:
getValue
in interfacePlexusConfiguration
- Returns:
- the value of this configuration
-
getValue
public String getValue(String defaultValue)
Description copied from interface:PlexusConfiguration
Returns the value of this configuration, or default if one cannot be found.- Specified by:
getValue
in interfacePlexusConfiguration
- Parameters:
defaultValue
- value to return if none is found- Returns:
- the value of this configuration
-
setValue
public void setValue(String val)
Description copied from interface:PlexusConfiguration
Set the value of a configuration element.- Specified by:
setValue
in interfacePlexusConfiguration
- Parameters:
val
- The value of the configuration element.
-
setValueAndGetSelf
public PlexusConfiguration setValueAndGetSelf(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 interfacePlexusConfiguration
- Parameters:
val
- set the value.- Returns:
PlexusConfiguration
-
setAttribute
public void setAttribute(String name, String value)
Description copied from interface:PlexusConfiguration
Sets an attribute on this configuration.- Specified by:
setAttribute
in interfacePlexusConfiguration
- Parameters:
name
- name of the attributevalue
- the value of the attribute.
-
getAttribute
public String getAttribute(String name)
Description copied from interface:PlexusConfiguration
Returns the value of the named attribute.- Specified by:
getAttribute
in interfacePlexusConfiguration
- Parameters:
name
- The name of the attribute.- Returns:
- the value of the named attribute
-
getAttribute
public String getAttribute(String name, 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 interfacePlexusConfiguration
- Parameters:
name
- The name of the attribute.defaultValue
- value to return if none is found- Returns:
- the value of the named attribute
-
getAttributeNames
public String[] getAttributeNames()
Description copied from interface:PlexusConfiguration
Returns an array of attribute names.- Specified by:
getAttributeNames
in interfacePlexusConfiguration
- Returns:
- an array of attribute names
-
getChild
public PlexusConfiguration getChild(String name)
Description copied from interface:PlexusConfiguration
Returns the child configuration of the given name.- Specified by:
getChild
in interfacePlexusConfiguration
- 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 interfacePlexusConfiguration
- Parameters:
i
- the position of the child under this configuration- Returns:
- the child configuration at the given location
-
getChild
public PlexusConfiguration getChild(String name, boolean createChild)
Description copied from interface:PlexusConfiguration
Returns the child configuration of the given name.- Specified by:
getChild
in interfacePlexusConfiguration
- Parameters:
name
- the name of the child to returncreateChild
- 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 interfacePlexusConfiguration
- Returns:
- an array of all child configurations
-
getChildren
public PlexusConfiguration[] getChildren(String name)
Description copied from interface:PlexusConfiguration
Returns an array of all child configurations with the given name.- Specified by:
getChildren
in interfacePlexusConfiguration
- 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 interfacePlexusConfiguration
- Parameters:
child
- the child configuration to add
-
addChild
public PlexusConfiguration addChild(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 interfacePlexusConfiguration
- Parameters:
name
- The name of the element.- Returns:
PlexusConfiguration
-
addChild
public PlexusConfiguration addChild(String name, 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 interfacePlexusConfiguration
- Parameters:
name
- The name of the child element.value
- The value of the child element.- Returns:
PlexusConfiguration
-
getChildCount
public int getChildCount()
Description copied from interface:PlexusConfiguration
Returns the number of directly children under this configuration.- Specified by:
getChildCount
in interfacePlexusConfiguration
- Returns:
- the number of directly children under this configuration.
-
-