Class DefaultConfiguration

  • All Implemented Interfaces:
    Configuration, java.io.Serializable

    public final class DefaultConfiguration
    extends java.lang.Object
    implements Configuration
    Default implementation of the Configuration interface.
    See Also:
    Serialized Form
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addAttribute​(java.lang.String attributeName, java.lang.String value)
      Adds an attribute to this configuration.
      void addChild​(Configuration configuration)
      Makes a configuration a child of this configuration.
      void addMessage​(java.lang.String key, java.lang.String value)
      Adds a custom message to this configuration.
      java.lang.String getAttribute​(java.lang.String attributeName)
      The attribute value for an attribute name.
      java.lang.String[] getAttributeNames()
      The set of attribute names.
      Configuration[] getChildren()
      The set of child configurations.
      java.util.Map<java.lang.String,​java.lang.String> getMessages()
      Returns an unmodifiable map instance containing the custom messages for this configuration.
      java.lang.String getName()
      The name of this configuration.
      ThreadModeSettings getThreadModeSettings()
      Gets the thread mode configuration.
      void removeChild​(Configuration configuration)
      Removes a child of this configuration.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DefaultConfiguration

        public DefaultConfiguration​(java.lang.String name)
        Instantiates a DefaultConfiguration.
        Parameters:
        name - the name for this DefaultConfiguration.
      • DefaultConfiguration

        public DefaultConfiguration​(java.lang.String name,
                                    ThreadModeSettings threadModeSettings)
        Instantiates a DefaultConfiguration.
        Parameters:
        name - the name for this DefaultConfiguration.
        threadModeSettings - the thread mode configuration.
    • Method Detail

      • getAttributeNames

        public java.lang.String[] getAttributeNames()
        Description copied from interface: Configuration
        The set of attribute names.
        Specified by:
        getAttributeNames in interface Configuration
        Returns:
        The set of attribute names, never null.
      • getAttribute

        public java.lang.String getAttribute​(java.lang.String attributeName)
                                      throws CheckstyleException
        Description copied from interface: Configuration
        The attribute value for an attribute name.
        Specified by:
        getAttribute in interface Configuration
        Parameters:
        attributeName - the attribute name
        Returns:
        the value that is associated with name
        Throws:
        CheckstyleException - if name is not a valid attribute name
      • getName

        public java.lang.String getName()
        Description copied from interface: Configuration
        The name of this configuration.
        Specified by:
        getName in interface Configuration
        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​(java.lang.String attributeName,
                                 java.lang.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​(java.lang.String key,
                               java.lang.String value)
        Adds a custom message to this configuration.
        Parameters:
        key - the message key
        value - the custom message pattern
      • getMessages

        public java.util.Map<java.lang.String,​java.lang.String> getMessages()
        Returns an unmodifiable map instance containing the custom messages for this configuration.
        Specified by:
        getMessages in interface Configuration
        Returns:
        unmodifiable map containing custom messages
      • getThreadModeSettings

        public ThreadModeSettings getThreadModeSettings()
        Gets the thread mode configuration.
        Returns:
        the thread mode configuration.