Interface PlexusConfiguration
-
- All Known Implementing Classes:
DefaultPlexusConfiguration,XmlPlexusConfiguration
public interface PlexusConfigurationA configuration data hierarchy for configuring aspects of plexus. For example, to populate a ComponentDescriptor. Implementation of PlexusConfiguration may be populated by any means, for example, by XML file.
-
-
Method Summary
All Methods Instance Methods Abstract 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 configuration)Adds a configuration under this configuration, which acts as a parent.StringgetAttribute(String paramName)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 child)Returns the child configuration of the given name.PlexusConfigurationgetChild(String child, 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 value)Set the value of a configuration element.PlexusConfigurationsetValueAndGetSelf(String value)Set the value of a configuration element and return the PlexusConfiguration object so that further operations can be carried out.
-
-
-
Method Detail
-
getName
String getName()
Returns the name of this configuration.- Returns:
- the name of this configuration
-
setName
void setName(String name)
Sets the name of this configuration.- Parameters:
name- The name of the configuration.
-
getValue
String getValue() throws PlexusConfigurationException
Returns the value of this configuration.- Returns:
- the value of this configuration
- Throws:
PlexusConfigurationException- in case of an error.
-
getValue
String getValue(String defaultValue)
Returns the value of this configuration, or default if one cannot be found.- Parameters:
defaultValue- value to return if none is found- Returns:
- the value of this configuration
-
setValue
void setValue(String value)
Set the value of a configuration element.- Parameters:
value- The value of the configuration element.
-
setValueAndGetSelf
PlexusConfiguration setValueAndGetSelf(String value)
Set the value of a configuration element and return the PlexusConfiguration object so that further operations can be carried out.- Parameters:
value- set the value.- Returns:
PlexusConfiguration
-
setAttribute
void setAttribute(String name, String value)
Sets an attribute on this configuration.- Parameters:
name- name of the attributevalue- the value of the attribute.
-
getAttributeNames
String[] getAttributeNames()
Returns an array of attribute names.- Returns:
- an array of attribute names
-
getAttribute
String getAttribute(String paramName) throws PlexusConfigurationException
Returns the value of the named attribute.- Parameters:
paramName- The name of the attribute.- Returns:
- the value of the named attribute
- Throws:
PlexusConfigurationException- in case of an error.
-
getAttribute
String getAttribute(String name, String defaultValue)
Returns the value of the named attribute, or default if one cannot be found.- Parameters:
name- The name of the attribute.defaultValue- value to return if none is found- Returns:
- the value of the named attribute
-
getChild
PlexusConfiguration getChild(String child)
Returns the child configuration of the given name.- Parameters:
child- the name of the child to return- Returns:
- the child configuration of the given name
-
getChild
PlexusConfiguration getChild(int i)
Returns the child configuration at the given location.- Parameters:
i- the position of the child under this configuration- Returns:
- the child configuration at the given location
-
getChild
PlexusConfiguration getChild(String child, boolean createChild)
Returns the child configuration of the given name.- Parameters:
child- 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
PlexusConfiguration[] getChildren()
Returns an array of all child configurations.- Returns:
- an array of all child configurations
-
getChildren
PlexusConfiguration[] getChildren(String name)
Returns an array of all child configurations with the given name.- Parameters:
name- the name of the children configurations to return- Returns:
- an array of all child configurations with the given name
-
addChild
void addChild(PlexusConfiguration configuration)
Adds a configuration under this configuration, which acts as a parent.- Parameters:
configuration- the child configuration to add
-
addChild
PlexusConfiguration addChild(String name)
Add a child element with a given name and return the newly created element.- Parameters:
name- The name of the element.- Returns:
PlexusConfiguration
-
addChild
PlexusConfiguration addChild(String name, String value)
Add a child element with a given name, and given value and return the newly created element.- Parameters:
name- The name of the child element.value- The value of the child element.- Returns:
PlexusConfiguration
-
getChildCount
int getChildCount()
Returns the number of directly children under this configuration.- Returns:
- the number of directly children under this configuration.
-
-