001/*
002 * #%L
003 * SIH-Adagio
004 * $Id: javaMergeMappings.xml 12002 2014-03-26 10:17:22Z bl05b3e $
005 * $HeadURL: https://forge.ifremer.fr/svn/sih-adagio/tags/adagio-3.5.6/mda/src/main/config/javaMergeMappings.xml $
006 * %%
007 * Copyright (C) 2012 - 2013 Ifremer
008 * %%
009 * This program is free software: you can redistribute it and/or modify
010 * it under the terms of the GNU Affero General Public License as published by
011 * the Free Software Foundation, either version 3 of the License, or
012 * (at your option) any later version.
013 * 
014 * This program is distributed in the hope that it will be useful,
015 * but WITHOUT ANY WARRANTY; without even the implied warranty of
016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
017 * GNU General Public License for more details.
018 * 
019 * You should have received a copy of the GNU Affero General Public License
020 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
021 * #L%
022 */
023//
024// Attention: Generated code! Do not modify by hand!
025// Generated by: TypeSafeEnumeration.vsl in andromda-java-cartridge.
026// Model Class:  Data::fr.ifremer.adagio.core.dao::referential::pmfm::ParameterGroupId
027// Metafacade:   org.andromda.metafacades.uml.Enumeration
028// Stereotype:  Enumeration
029//
030package fr.ifremer.adagio.core.dao.referential.pmfm;
031
032import fr.ifremer.adagio.core.dao.technical.AdagioEnumerationDef;
033import java.io.Serializable;
034import java.util.ArrayList;
035import java.util.Collections;
036import java.util.LinkedHashMap;
037import java.util.List;
038import java.util.Map;
039import static org.nuiton.i18n.I18n.n;
040
041/**
042 * 
043 */
044public enum ParameterGroupId
045    implements Serializable, AdagioEnumerationDef<Integer>
046{
047    /** TODO: Model Documentation for Enumeration Literal SURVEY_MEASUREMENT value 21 */
048    SURVEY_MEASUREMENT (
049            "adagio.enumeration.ParameterGroupId.SURVEY_MEASUREMENT", 
050            n("adagio.enumeration.ParameterGroupId.SURVEY_MEASUREMENT.description"), 
051            21);
052
053    /**
054     * The serial version UID of this class. Needed for serialization.
055     */
056    private static final long serialVersionUID = -578292940907243676L;
057
058    private String key;
059    private String description;
060    private Integer enumValue;
061
062    private ParameterGroupId(String key, String description, Integer value)
063    {
064        this.key = key;
065        this.description = description;
066        this.enumValue = value;
067    }
068    
069    @Override
070    public void setValue(Integer newValue) {
071        if (newValue != null && !this.enumValue.equals(newValue)) {
072            // Update static lists
073            values.remove(this.enumValue);
074            literals.remove(this.enumValue);
075            this.enumValue = newValue;
076            values.put(this.enumValue, this);
077            literals.add(this.enumValue);
078        }
079    }
080    
081
082    @Override
083    public String getValueAsString()
084    {
085        return String.valueOf(this.enumValue);
086    }
087
088    /**
089     * Retrieves an instance of ParameterGroupId from <code>its name</code>.
090     *
091     * @param name the name to create the ParameterGroupId from.
092     * @return The enumeration literal named after the 'name' argument
093     */
094    public static ParameterGroupId fromString(String name)
095    {
096        return ParameterGroupId.valueOf(name);
097    }
098
099    /**
100     * Returns an enumeration literal Integer <code>value</code>.
101     * Required by JAXB2 enumeration implementation
102     *
103     * @return Integer with corresponding value
104     */
105    public Integer value()
106    {
107        return this.enumValue;
108    }
109
110    /**
111     * Returns an instance of ParameterGroupId from Integer <code>value</code>.
112     * Required by JAXB2 enumeration implementation
113     *
114     * @param value the value to create the ParameterGroupId from.
115     * @return static Enumeration with corresponding value
116     */
117    public static ParameterGroupId fromValue(Integer value)
118    {
119        for (ParameterGroupId enumName: ParameterGroupId.values())
120        {
121            if (enumName.getValue().equals(value))
122            {
123                return enumName;
124            }
125        }
126        throw new IllegalArgumentException("ParameterGroupId.fromValue(" + value.toString() + ')');
127    }
128
129    /**
130     * Gets the underlying value of this type safe enumeration.
131     * This method is necessary to comply with DaoBase implementation.
132     * @return The name of this literal.
133     */
134    public Integer getValue()
135    {
136        return this.enumValue;
137    }
138    
139    @Override
140    public String getDescription() {
141        return description;
142    }
143    
144    @Override
145    public String getKey() {
146        return key;
147    }
148    
149    @Override
150    public Class<?> getType() {
151        return Integer.class;
152    }
153    
154    /**
155     * Returns an unmodifiable list containing the literals that are known by this enumeration.
156     *
157     * @return A List containing the actual literals defined by this enumeration, this list
158     *         can not be modified.
159     */
160    public static List<Integer> literals()
161    {
162        return ParameterGroupId.literals;
163    }
164
165    /**
166     * Returns an unmodifiable list containing the names of the literals that are known
167     * by this enumeration.
168     *
169     * @return A List containing the actual names of the literals defined by this
170     *         enumeration, this list can not be modified.
171     */
172    public static List<String> names()
173    {
174        return ParameterGroupId.names;
175    }
176
177    private static Map<Integer, ParameterGroupId> values = new LinkedHashMap<Integer, ParameterGroupId>(1, 1);
178    private static List<Integer> literals = new ArrayList<Integer>(1);
179    private static List<String> names = new ArrayList<String>(1);
180    private static List<ParameterGroupId> valueList = new ArrayList<ParameterGroupId>(1);
181
182    /**
183     * Initializes the values.
184     */
185    static
186    {
187        synchronized (ParameterGroupId.values)
188        {
189            ParameterGroupId.values.put(SURVEY_MEASUREMENT.enumValue, SURVEY_MEASUREMENT);
190        }
191        synchronized (ParameterGroupId.valueList)
192        {
193            ParameterGroupId.valueList.add(SURVEY_MEASUREMENT);
194            // For Adagio, lists could be reload from configuration
195            //ParameterGroupId.valueList = Collections.unmodifiableList(valueList);
196        }
197        synchronized (ParameterGroupId.literals)
198        {
199            ParameterGroupId.literals.add(SURVEY_MEASUREMENT.enumValue);
200            // For Adagio, lists could be reload from configuration
201            //ParameterGroupId.literals = Collections.unmodifiableList(literals);
202        }
203        synchronized (ParameterGroupId.names)
204        {
205            ParameterGroupId.names.add("SURVEY_MEASUREMENT");
206            ParameterGroupId.names = Collections.unmodifiableList(names);
207        }
208    }
209    // type-safe-enumeration-object java merge-point
210}