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::location::LocationClassificationId
027// Metafacade:   org.andromda.metafacades.uml.Enumeration
028// Stereotype:  Enumeration
029//
030package fr.ifremer.adagio.core.dao.referential.location;
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 LocationClassificationId
045    implements Serializable, AdagioEnumerationDef<Integer>
046{
047    /** TODO: Model Documentation for Enumeration Literal TERRITORIAL value 1 */
048    TERRITORIAL (
049            "adagio.enumeration.LocationClassificationId.TERRITORIAL", 
050            n("adagio.enumeration.LocationClassificationId.TERRITORIAL.description"), 
051            1),
052    /** TODO: Model Documentation for Enumeration Literal SECTOR value 2 */
053    SECTOR (
054            "adagio.enumeration.LocationClassificationId.SECTOR", 
055            n("adagio.enumeration.LocationClassificationId.SECTOR.description"), 
056            2),
057    /** TODO: Model Documentation for Enumeration Literal REGULATION value 3 */
058    REGULATION (
059            "adagio.enumeration.LocationClassificationId.REGULATION", 
060            n("adagio.enumeration.LocationClassificationId.REGULATION.description"), 
061            3);
062
063    /**
064     * The serial version UID of this class. Needed for serialization.
065     */
066    private static final long serialVersionUID = -458258057865756532L;
067
068    private String key;
069    private String description;
070    private Integer enumValue;
071
072    private LocationClassificationId(String key, String description, Integer value)
073    {
074        this.key = key;
075        this.description = description;
076        this.enumValue = value;
077    }
078    
079    @Override
080    public void setValue(Integer newValue) {
081        if (newValue != null && !this.enumValue.equals(newValue)) {
082            // Update static lists
083            values.remove(this.enumValue);
084            literals.remove(this.enumValue);
085            this.enumValue = newValue;
086            values.put(this.enumValue, this);
087            literals.add(this.enumValue);
088        }
089    }
090    
091
092    @Override
093    public String getValueAsString()
094    {
095        return String.valueOf(this.enumValue);
096    }
097
098    /**
099     * Retrieves an instance of LocationClassificationId from <code>its name</code>.
100     *
101     * @param name the name to create the LocationClassificationId from.
102     * @return The enumeration literal named after the 'name' argument
103     */
104    public static LocationClassificationId fromString(String name)
105    {
106        return LocationClassificationId.valueOf(name);
107    }
108
109    /**
110     * Returns an enumeration literal Integer <code>value</code>.
111     * Required by JAXB2 enumeration implementation
112     *
113     * @return Integer with corresponding value
114     */
115    public Integer value()
116    {
117        return this.enumValue;
118    }
119
120    /**
121     * Returns an instance of LocationClassificationId from Integer <code>value</code>.
122     * Required by JAXB2 enumeration implementation
123     *
124     * @param value the value to create the LocationClassificationId from.
125     * @return static Enumeration with corresponding value
126     */
127    public static LocationClassificationId fromValue(Integer value)
128    {
129        for (LocationClassificationId enumName: LocationClassificationId.values())
130        {
131            if (enumName.getValue().equals(value))
132            {
133                return enumName;
134            }
135        }
136        throw new IllegalArgumentException("LocationClassificationId.fromValue(" + value.toString() + ')');
137    }
138
139    /**
140     * Gets the underlying value of this type safe enumeration.
141     * This method is necessary to comply with DaoBase implementation.
142     * @return The name of this literal.
143     */
144    public Integer getValue()
145    {
146        return this.enumValue;
147    }
148    
149    @Override
150    public String getDescription() {
151        return description;
152    }
153    
154    @Override
155    public String getKey() {
156        return key;
157    }
158    
159    @Override
160    public Class<?> getType() {
161        return Integer.class;
162    }
163    
164    /**
165     * Returns an unmodifiable list containing the literals that are known by this enumeration.
166     *
167     * @return A List containing the actual literals defined by this enumeration, this list
168     *         can not be modified.
169     */
170    public static List<Integer> literals()
171    {
172        return LocationClassificationId.literals;
173    }
174
175    /**
176     * Returns an unmodifiable list containing the names of the literals that are known
177     * by this enumeration.
178     *
179     * @return A List containing the actual names of the literals defined by this
180     *         enumeration, this list can not be modified.
181     */
182    public static List<String> names()
183    {
184        return LocationClassificationId.names;
185    }
186
187    private static Map<Integer, LocationClassificationId> values = new LinkedHashMap<Integer, LocationClassificationId>(3, 1);
188    private static List<Integer> literals = new ArrayList<Integer>(3);
189    private static List<String> names = new ArrayList<String>(3);
190    private static List<LocationClassificationId> valueList = new ArrayList<LocationClassificationId>(3);
191
192    /**
193     * Initializes the values.
194     */
195    static
196    {
197        synchronized (LocationClassificationId.values)
198        {
199            LocationClassificationId.values.put(TERRITORIAL.enumValue, TERRITORIAL);
200            LocationClassificationId.values.put(SECTOR.enumValue, SECTOR);
201            LocationClassificationId.values.put(REGULATION.enumValue, REGULATION);
202        }
203        synchronized (LocationClassificationId.valueList)
204        {
205            LocationClassificationId.valueList.add(TERRITORIAL);
206            LocationClassificationId.valueList.add(SECTOR);
207            LocationClassificationId.valueList.add(REGULATION);
208            // For Adagio, lists could be reload from configuration
209            //LocationClassificationId.valueList = Collections.unmodifiableList(valueList);
210        }
211        synchronized (LocationClassificationId.literals)
212        {
213            LocationClassificationId.literals.add(TERRITORIAL.enumValue);
214            LocationClassificationId.literals.add(SECTOR.enumValue);
215            LocationClassificationId.literals.add(REGULATION.enumValue);
216            // For Adagio, lists could be reload from configuration
217            //LocationClassificationId.literals = Collections.unmodifiableList(literals);
218        }
219        synchronized (LocationClassificationId.names)
220        {
221            LocationClassificationId.names.add("TERRITORIAL");
222            LocationClassificationId.names.add("SECTOR");
223            LocationClassificationId.names.add("REGULATION");
224            LocationClassificationId.names = Collections.unmodifiableList(names);
225        }
226    }
227    // type-safe-enumeration-object java merge-point
228}