View Javadoc
1   /*
2     * #%L
3     * Quadrige3 Core
4     * %%
5     * Copyright (C) 2017 Ifremer
6     * %%
7     * This program is free software: you can redistribute it and/or modify
8     * it under the terms of the GNU Affero General Public License as published by
9     * the Free Software Foundation, either version 3 of the License, or
10    * (at your option) any later version.
11    *
12    * This program is distributed in the hope that it will be useful,
13    * but WITHOUT ANY WARRANTY; without even the implied warranty of
14    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    * GNU General Public License for more details.
16    *
17    * You should have received a copy of the GNU Affero General Public License
18    * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19    * #L%
20    */
21  //
22  // Attention: Generated code! Do not modify by hand!
23  // Generated by: TypeSafeEnumeration.vsl in andromda-java-cartridge.
24  // Model Class:  Données::fr.ifremer.quadrige3.core::dao::referential::AcquisitionLevelCode
25  // Metafacade:   org.andromda.metafacades.uml.Enumeration
26  // Stereotype:  Enumeration
27  //
28  package fr.ifremer.quadrige3.core.dao.referential;
29  
30  import fr.ifremer.quadrige3.core.dao.technical.QuadrigeEnumerationDef;
31  import java.io.Serializable;
32  import java.util.ArrayList;
33  import java.util.Collections;
34  import java.util.LinkedHashMap;
35  import java.util.List;
36  import java.util.Map;
37  import static org.nuiton.i18n.I18n.n;
38  
39  /**
40   * 
41   */
42  public enum AcquisitionLevelCode
43      implements Serializable, QuadrigeEnumerationDef<String>
44  {
45      SURVEY (
46  			"quadrige3.enumeration.AcquisitionLevelCode.SURVEY",
47  			n("quadrige3.enumeration.AcquisitionLevelCode.SURVEY.description"),
48  			"PASS"),
49      SAMPLE (
50  			"quadrige3.enumeration.AcquisitionLevelCode.SAMPLE",
51  			n("quadrige3.enumeration.AcquisitionLevelCode.SAMPLE.description"),
52  			"ECHANT"),
53      SAMPLING_OPERATION (
54  			"quadrige3.enumeration.AcquisitionLevelCode.SAMPLING_OPERATION",
55  			n("quadrige3.enumeration.AcquisitionLevelCode.SAMPLING_OPERATION.description"),
56  			"PREL");
57  
58      /**
59       * The serial version UID of this class. Needed for serialization.
60       */
61      private static final long serialVersionUID = -727653841763645900L;
62  
63      private String key;
64      private String description;
65      private String enumValue;
66  
67      /**
68       * The constructor with enumeration literal value allowing
69       * super classes to access it.
70       */
71      private AcquisitionLevelCode(String key, String description, String value)
72      {
73      	this.key = key;
74      	this.description = description;
75          this.enumValue = value;
76      }
77      
78      @Override
79       /**
80        * Setter for value. Use to override value, from configuration
81        */
82       public void setValue(String newValue) {
83  		if (newValue != null && !this.enumValue.equals(newValue)) {
84  			// Update static lists
85  	    	values.remove(this.enumValue);
86  	    	literals.remove(this.enumValue);
87  	    	this.enumValue = newValue;
88  	    	values.put(this.enumValue, this);
89  	    	literals.add(this.enumValue);
90  		}
91      }
92      
93  
94      @Override
95      public String getValueAsString()
96      {
97          return String.valueOf(this.enumValue);
98      }
99  
100     /**
101      * Retrieves an instance of AcquisitionLevelCode from <code>its name</code>.
102      *
103      * @param name the name to create the AcquisitionLevelCode from.
104      * @return The enumeration literal named after the 'name' argument
105      */
106     public static AcquisitionLevelCode fromString(String name)
107     {
108         return AcquisitionLevelCode.valueOf(name);
109     }
110 
111     /**
112      * Returns an enumeration literal String <code>value</code>.
113      * Required by JAXB2 enumeration implementation
114      *
115      * @return String with corresponding value
116      */
117     public String value()
118     {
119         return this.enumValue;
120     }
121 
122     /**
123      * Returns an instance of AcquisitionLevelCode from String <code>value</code>.
124      * Required by JAXB2 enumeration implementation
125      *
126      * @param value the value to create the AcquisitionLevelCode from.
127      * @return static Enumeration with corresponding value
128      */
129     public static AcquisitionLevelCode fromValue(String value)
130     {
131         for (AcquisitionLevelCode enumName: AcquisitionLevelCode.values())
132         {
133             if (enumName.getValue().equals(value))
134             {
135                 return enumName;
136             }
137         }
138         throw new IllegalArgumentException("AcquisitionLevelCode.fromValue(" + value + ')');
139     }
140 
141     /**
142      * Gets the underlying value of this type safe enumeration.
143      * This method is necessary to comply with DaoBase implementation.
144      * @return The name of this literal.
145      */
146     public String getValue()
147     {
148         return this.enumValue;
149     }
150     
151     @Override
152     public String getDescription() {
153     	return description;
154     }
155     
156     @Override
157     public String getKey() {
158     	return key;
159     }
160     
161     @Override
162     public Class<?> getType() {
163     	return String.class;
164     }
165     
166     /**
167      * Returns an unmodifiable list containing the literals that are known by this enumeration.
168      *
169      * @return A List containing the actual literals defined by this enumeration, this list
170      *         can not be modified.
171      */
172     public static List<String> literals()
173     {
174         return AcquisitionLevelCode.literals;
175     }
176 
177     /**
178      * Returns an unmodifiable list containing the names of the literals that are known
179      * by this enumeration.
180      *
181      * @return A List containing the actual names of the literals defined by this
182      *         enumeration, this list can not be modified.
183      */
184     public static List<String> names()
185     {
186         return AcquisitionLevelCode.names;
187     }
188 
189     private static Map<String, AcquisitionLevelCode> values = new LinkedHashMap<String, AcquisitionLevelCode>(3, 1);
190     private static List<String> literals = new ArrayList<String>(3);
191     private static List<String> names = new ArrayList<String>(3);
192     private static List<AcquisitionLevelCode> valueList = new ArrayList<AcquisitionLevelCode>(3);
193 
194     /**
195      * Initializes the values.
196      */
197     static
198     {
199         synchronized (AcquisitionLevelCode.values)
200         {
201             AcquisitionLevelCode.values.put(SURVEY.enumValue, SURVEY);
202             AcquisitionLevelCode.values.put(SAMPLE.enumValue, SAMPLE);
203             AcquisitionLevelCode.values.put(SAMPLING_OPERATION.enumValue, SAMPLING_OPERATION);
204         }
205         synchronized (AcquisitionLevelCode.valueList)
206         {
207             AcquisitionLevelCode.valueList.add(SURVEY);
208             AcquisitionLevelCode.valueList.add(SAMPLE);
209             AcquisitionLevelCode.valueList.add(SAMPLING_OPERATION);
210             // For Quadrige3, lists could be reload from configuration (see method 'setValue')
211             //AcquisitionLevelCode.valueList = Collections.unmodifiableList(valueList);
212         }
213         synchronized (AcquisitionLevelCode.literals)
214         {
215             AcquisitionLevelCode.literals.add(SURVEY.enumValue);
216             AcquisitionLevelCode.literals.add(SAMPLE.enumValue);
217             AcquisitionLevelCode.literals.add(SAMPLING_OPERATION.enumValue);
218             // For Quadrige3, lists could be reload from configuration (see method 'setValue')
219             //AcquisitionLevelCode.literals = Collections.unmodifiableList(literals);
220         }
221         synchronized (AcquisitionLevelCode.names)
222         {
223             AcquisitionLevelCode.names.add("SURVEY");
224             AcquisitionLevelCode.names.add("SAMPLE");
225             AcquisitionLevelCode.names.add("SAMPLING_OPERATION");
226             AcquisitionLevelCode.names = Collections.unmodifiableList(names);
227         }
228     }
229     // type-safe-enumeration-object java merge-point
230 }