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 protectedDefaultPlexusConfiguration()protectedDefaultPlexusConfiguration(String name)protectedDefaultPlexusConfiguration(String name, String value)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PlexusConfigurationaddChild(String name)Add a child element with a given name and return the newly created element.PlexusConfigurationaddChild(String name, String value)Add a child element with a given name, and given value and return the newly created element.voidaddChild(PlexusConfiguration child)Adds a configuration under this configuration, which acts as a parent.StringgetAttribute(String name)Returns the value of the named attribute.StringgetAttribute(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.PlexusConfigurationgetChild(int i)Returns the child configuration at the given location.PlexusConfigurationgetChild(String name)Returns the child configuration of the given name.PlexusConfigurationgetChild(String name, boolean createChild)Returns the child configuration of the given name.intgetChildCount()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.StringgetName()Returns the name of this configuration.StringgetValue()Returns the value of this configuration.StringgetValue(String defaultValue)Returns the value of this configuration, or default if one cannot be found.voidsetAttribute(String name, String value)Sets an attribute on this configuration.voidsetName(String name)Sets the name of this configuration.voidsetValue(String val)Set the value of a configuration element.PlexusConfigurationsetValueAndGetSelf(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:PlexusConfigurationReturns the name of this configuration.- Specified by:
getNamein interfacePlexusConfiguration- Returns:
- the name of this configuration
-
setName
public void setName(String name)
Description copied from interface:PlexusConfigurationSets the name of this configuration.- Specified by:
setNamein interfacePlexusConfiguration- Parameters:
name- The name of the configuration.
-
getValue
public String getValue()
Description copied from interface:PlexusConfigurationReturns the value of this configuration.- Specified by:
getValuein interfacePlexusConfiguration- Returns:
- the value of this configuration
-
getValue
public String getValue(String defaultValue)
Description copied from interface:PlexusConfigurationReturns the value of this configuration, or default if one cannot be found.- Specified by:
getValuein 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:PlexusConfigurationSet the value of a configuration element.- Specified by:
setValuein interfacePlexusConfiguration- Parameters:
val- The value of the configuration element.
-
setValueAndGetSelf
public PlexusConfiguration setValueAndGetSelf(String val)
Description copied from interface:PlexusConfigurationSet the value of a configuration element and return the PlexusConfiguration object so that further operations can be carried out.- Specified by:
setValueAndGetSelfin interfacePlexusConfiguration- Parameters:
val- set the value.- Returns:
PlexusConfiguration
-
setAttribute
public void setAttribute(String name, String value)
Description copied from interface:PlexusConfigurationSets an attribute on this configuration.- Specified by:
setAttributein interfacePlexusConfiguration- Parameters:
name- name of the attributevalue- the value of the attribute.
-
getAttribute
public String getAttribute(String name)
Description copied from interface:PlexusConfigurationReturns the value of the named attribute.- Specified by:
getAttributein 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:PlexusConfigurationReturns the value of the named attribute, or default if one cannot be found.- Specified by:
getAttributein 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:PlexusConfigurationReturns an array of attribute names.- Specified by:
getAttributeNamesin interfacePlexusConfiguration- Returns:
- an array of attribute names
-
getChild
public PlexusConfiguration getChild(String name)
Description copied from interface:PlexusConfigurationReturns the child configuration of the given name.- Specified by:
getChildin 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:PlexusConfigurationReturns the child configuration at the given location.- Specified by:
getChildin 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:PlexusConfigurationReturns the child configuration of the given name.- Specified by:
getChildin 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:PlexusConfigurationReturns an array of all child configurations.- Specified by:
getChildrenin interfacePlexusConfiguration- Returns:
- an array of all child configurations
-
getChildren
public PlexusConfiguration[] getChildren(String name)
Description copied from interface:PlexusConfigurationReturns an array of all child configurations with the given name.- Specified by:
getChildrenin 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:PlexusConfigurationAdds a configuration under this configuration, which acts as a parent.- Specified by:
addChildin interfacePlexusConfiguration- Parameters:
child- the child configuration to add
-
addChild
public PlexusConfiguration addChild(String name)
Description copied from interface:PlexusConfigurationAdd a child element with a given name and return the newly created element.- Specified by:
addChildin interfacePlexusConfiguration- Parameters:
name- The name of the element.- Returns:
PlexusConfiguration
-
addChild
public PlexusConfiguration addChild(String name, String value)
Description copied from interface:PlexusConfigurationAdd a child element with a given name, and given value and return the newly created element.- Specified by:
addChildin 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:PlexusConfigurationReturns the number of directly children under this configuration.- Specified by:
getChildCountin interfacePlexusConfiguration- Returns:
- the number of directly children under this configuration.
-
-