Package com.puppycrawl.tools.checkstyle
Class DefaultConfiguration
- java.lang.Object
-
- com.puppycrawl.tools.checkstyle.DefaultConfiguration
-
- All Implemented Interfaces:
Configuration
,Serializable
public final class DefaultConfiguration extends Object implements Configuration
Default implementation of the Configuration interface.- Author:
- lkuehne
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DefaultConfiguration(String name)
Instantiates a DefaultConfiguration.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAttribute(String attributeName, String value)
Adds an attribute to this configuration.void
addChild(Configuration configuration)
Makes a configuration a child of this configuration.void
addMessage(String key, String value)
Adds a custom message to this configuration.String
getAttribute(String attributeName)
The attribute value for an attribute name.String[]
getAttributeNames()
The set of attribute names.Configuration[]
getChildren()
The set of child configurations.com.google.common.collect.ImmutableMap<String,String>
getMessages()
Returns an unmodifiable map instance containing the custom messages for this configuration.String
getName()
The name of this configuration.void
removeChild(Configuration configuration)
Removes a child of this configuration.
-
-
-
Constructor Detail
-
DefaultConfiguration
public DefaultConfiguration(String name)
Instantiates a DefaultConfiguration.- Parameters:
name
- the name for this DefaultConfiguration.
-
-
Method Detail
-
getAttributeNames
public String[] getAttributeNames()
Description copied from interface:Configuration
The set of attribute names.- Specified by:
getAttributeNames
in interfaceConfiguration
- Returns:
- The set of attribute names, never null.
-
getAttribute
public String getAttribute(String attributeName) throws CheckstyleException
Description copied from interface:Configuration
The attribute value for an attribute name.- Specified by:
getAttribute
in interfaceConfiguration
- Parameters:
attributeName
- the attribute name- Returns:
- the value that is associated with name
- Throws:
CheckstyleException
- if name is not a valid attribute name
-
getChildren
public Configuration[] getChildren()
Description copied from interface:Configuration
The set of child configurations.- Specified by:
getChildren
in interfaceConfiguration
- Returns:
- The set of child configurations, never null.
-
getName
public String getName()
Description copied from interface:Configuration
The name of this configuration.- Specified by:
getName
in interfaceConfiguration
- Returns:
- The name of this configuration.
-
addChild
public void addChild(Configuration configuration)
Makes a configuration a child of this configuration.- Parameters:
configuration
- the child configuration.
-
removeChild
public void removeChild(Configuration configuration)
Removes a child of this configuration.- Parameters:
configuration
- the child configuration to remove.
-
addAttribute
public void addAttribute(String attributeName, String value)
Adds an attribute to this configuration.- Parameters:
attributeName
- the name of the attribute.value
- the value of the attribute.
-
addMessage
public void addMessage(String key, String value)
Adds a custom message to this configuration.- Parameters:
key
- the message keyvalue
- the custom message pattern
-
getMessages
public com.google.common.collect.ImmutableMap<String,String> getMessages()
Returns an unmodifiable map instance containing the custom messages for this configuration.- Specified by:
getMessages
in interfaceConfiguration
- Returns:
- unmodifiable map containing custom messages
-
-