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.
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      A unique serial version identifier.
      See Also:
    • EMPTY_CONFIGURATION_ARRAY

      private static final Configuration[] EMPTY_CONFIGURATION_ARRAY
      Constant for optimization.
    • name

      private final String name
      The name of this configuration.
    • children

      private final List<Configuration> children
      The list of child Configurations.
    • propertyMap

      private final Map<String,String> propertyMap
      The map from property names to property values.
    • messages

      private final Map<String,String> messages
      The map containing custom messages.
    • threadModeSettings

      private final ThreadModeSettings threadModeSettings
      The thread mode configuration.
  • Constructor Details

    • DefaultConfiguration

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

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

    • getAttributeNames

      public 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 String getAttribute(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
    • getPropertyNames

      public String[] getPropertyNames()
      Description copied from interface: Configuration
      The set of property names.
      Specified by:
      getPropertyNames in interface Configuration
      Returns:
      The set of property names, never null.
    • getProperty

      public String getProperty(String propertyName) throws CheckstyleException
      Description copied from interface: Configuration
      The property value for n property name.
      Specified by:
      getProperty in interface Configuration
      Parameters:
      propertyName - the property name
      Returns:
      the value that is associated with name
      Throws:
      CheckstyleException - if name is not a valid property name
    • getChildren

      public Configuration[] getChildren()
      Description copied from interface: Configuration
      The set of child configurations.
      Specified by:
      getChildren in interface Configuration
      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 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

      @Deprecated public void addAttribute(String attributeName, String value)
      Deprecated.
      This shall be removed in future releases. Please use addProperty(String propertyName, String value) instead.
      Adds n property to this configuration.
      Parameters:
      attributeName - the name of the property.
      value - the value of the property.
    • addProperty

      public void addProperty(String propertyName, String value)
      Adds n property to this configuration.
      Parameters:
      propertyName - the name of the property.
      value - the value of the property.
    • addMessage

      public void addMessage(String key, String value)
      Adds a custom message to this configuration.
      Parameters:
      key - the message key
      value - the custom message pattern
    • getMessages

      public Map<String,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.