001///////////////////////////////////////////////////////////////////////////////////////////////
002// checkstyle: Checks Java source code and other text files for adherence to a set of rules.
003// Copyright (C) 2001-2024 the original author or authors.
004//
005// This library is free software; you can redistribute it and/or
006// modify it under the terms of the GNU Lesser General Public
007// License as published by the Free Software Foundation; either
008// version 2.1 of the License, or (at your option) any later version.
009//
010// This library is distributed in the hope that it will be useful,
011// but WITHOUT ANY WARRANTY; without even the implied warranty of
012// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
013// Lesser General Public License for more details.
014//
015// You should have received a copy of the GNU Lesser General Public
016// License along with this library; if not, write to the Free Software
017// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
018///////////////////////////////////////////////////////////////////////////////////////////////
019
020package com.puppycrawl.tools.checkstyle.api;
021
022import java.io.Serializable;
023import java.util.Map;
024
025/**
026 * A Configuration is used to configure a Configurable component.  The general
027 * idea of Configuration/Configurable was taken from <a target="_top"
028 * href="https://avalon.apache.org/closed.html">Jakarta's Avalon framework</a>.
029 */
030public interface Configuration extends Serializable {
031
032    /**
033     * The set of attribute names.
034     *
035     * @return The set of attribute names, never null.
036     * @deprecated This shall be removed in future releases. Please use
037     *      {@code getPropertyNames()} instead.
038     */
039    @Deprecated(since = "8.45")
040    String[] getAttributeNames();
041
042    /**
043     * The attribute value for an attribute name.
044     *
045     * @param name the attribute name
046     * @return the value that is associated with name
047     * @throws CheckstyleException if name is not a valid attribute name
048     * @deprecated This shall be removed in future releases. Please use
049     *      {@code getProperty(String name)} instead.
050     */
051    @Deprecated(since = "8.45")
052    String getAttribute(String name) throws CheckstyleException;
053
054    /**
055     * The set of property names.
056     *
057     * @return The set of property names, never null.
058     */
059    String[] getPropertyNames();
060
061    /**
062     * The property value for property name.
063     *
064     * @param name the property name
065     * @return the value that is associated with name
066     * @throws CheckstyleException if name is not a valid property name
067     */
068    String getProperty(String name) throws CheckstyleException;
069
070    /**
071     * The set of child configurations.
072     *
073     * @return The set of child configurations, never null.
074     */
075    Configuration[] getChildren();
076
077    /**
078     * The name of this configuration.
079     *
080     * @return The name of this configuration.
081     */
082    String getName();
083
084    /**
085     * Returns an unmodifiable map instance containing the custom messages
086     * for this configuration.
087     *
088     * @return unmodifiable map containing custom messages
089     */
090    Map<String, String> getMessages();
091
092}