001/*
002 *  Copyright 2016 Anyware Services
003 *
004 *  Licensed under the Apache License, Version 2.0 (the "License");
005 *  you may not use this file except in compliance with the License.
006 *  You may obtain a copy of the License at
007 *
008 *      http://www.apache.org/licenses/LICENSE-2.0
009 *
010 *  Unless required by applicable law or agreed to in writing, software
011 *  distributed under the License is distributed on an "AS IS" BASIS,
012 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 *  See the License for the specific language governing permissions and
014 *  limitations under the License.
015 */
016package org.ametys.runtime.config;
017
018import java.util.HashMap;
019import java.util.HashSet;
020import java.util.Map;
021import java.util.Set;
022
023import org.ametys.runtime.i18n.I18nizableText;
024import org.ametys.runtime.parameter.ParameterCheckerDescriptor;
025
026/**
027 * Represents a category of configuration parameters
028 */
029public class ConfigParameterCategory
030{
031    private Map<I18nizableText, ConfigParameterGroup> _groups;
032    private Set<ConfigParameterCheckerDescriptor> _paramCheckers;
033
034    ConfigParameterCategory ()
035    {
036        _groups = new HashMap<>();
037        _paramCheckers = new HashSet<>();
038    }
039    
040    void addParamChecker(ConfigParameterCheckerDescriptor paramChecker)
041    {
042        _paramCheckers.add(paramChecker);
043    }
044
045    /**
046     * Returns all {@link ConfigParameterGroup} for this category.
047     * @return all {@link ConfigParameterGroup} for this category.
048     */
049    public Map<I18nizableText, ConfigParameterGroup> getGroups()
050    {
051        return _groups;
052    }
053    
054    /**
055     * Set the configuration groups of this category
056     * @param groups the configuration groups
057     */
058    void setGroups(Map<I18nizableText, ConfigParameterGroup> groups)
059    {
060        this._groups = groups;
061    }
062    
063    /**
064     * Returns all {@link ParameterCheckerDescriptor} for this category.
065     * @return all {@link ParameterCheckerDescriptor} for this category.
066     */
067    public Set<ConfigParameterCheckerDescriptor> getParamCheckers()
068    {
069        return _paramCheckers;
070    }
071    
072    /**
073     * Set the parameter checkers of this category
074     * @param paramCheckers the parameter checkers
075     */
076    void setParamCheckers(Set<ConfigParameterCheckerDescriptor> paramCheckers)
077    {
078        this._paramCheckers = paramCheckers;
079    }
080}