001/*
002 *  Copyright 2019 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 org.ametys.runtime.model.CategorizedElementDefinitionWrapper;
019
020/**
021 * Object containing the definition of a configuration parameter and informations about its categories / groups and group switch
022 * @param <T> Type of the parameter value
023 */
024public class ConfigParameterDefinitionWrapper<T> extends CategorizedElementDefinitionWrapper<T>
025{
026    /** Defines if this definition is the group switch */
027    protected boolean _isGroupSwitch;
028    
029    /**
030     * Default constructor.
031     */
032    public ConfigParameterDefinitionWrapper()
033    {
034        super();
035    }
036    
037    /**
038     * Constructor by copying an existing {@link ConfigParameterDefinitionWrapper}.
039     * @param wrapperToCopy The {@link ConfigParameterDefinitionWrapper} to copy
040     */
041    public ConfigParameterDefinitionWrapper(CategorizedElementDefinitionWrapper<T> wrapperToCopy)
042    {
043        super(wrapperToCopy);
044        
045        // Group switch
046        setGroupSwitch(isGroupSwitch());
047    }
048    
049    /**
050     * Retrieves true if this definition is the group switch
051     * @return true if this definition is the group switch, false otherwise
052     */
053    public boolean isGroupSwitch()
054    {
055        return _isGroupSwitch;
056    }
057    
058    /***
059     * Sets the group switch
060     * @param isGroupSwitch true if this definition is the group switch
061     */
062    public void setGroupSwitch(boolean isGroupSwitch)
063    {
064        _isGroupSwitch = isGroupSwitch;
065    }
066}