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::transcribing::TranscribingSideId
25  // Metafacade:   org.andromda.metafacades.uml.Enumeration
26  // Stereotype:  Enumeration
27  //
28  package fr.ifremer.quadrige3.core.dao.referential.transcribing;
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 TranscribingSideId
43      implements Serializable, QuadrigeEnumerationDef<Integer>
44  {
45      IN (
46  			"quadrige3.enumeration.TranscribingSideId.IN",
47  			n("quadrige3.enumeration.TranscribingSideId.IN.description"),
48  			2),
49      IN_OUT (
50  			"quadrige3.enumeration.TranscribingSideId.IN_OUT",
51  			n("quadrige3.enumeration.TranscribingSideId.IN_OUT.description"),
52  			3),
53      OUT (
54  			"quadrige3.enumeration.TranscribingSideId.OUT",
55  			n("quadrige3.enumeration.TranscribingSideId.OUT.description"),
56  			1);
57  
58      /**
59       * The serial version UID of this class. Needed for serialization.
60       */
61      private static final long serialVersionUID = -3482211600946580696L;
62  
63      private String key;
64      private String description;
65      private Integer enumValue;
66  
67      /**
68       * The constructor with enumeration literal value allowing
69       * super classes to access it.
70       */
71      private TranscribingSideId(String key, String description, Integer 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(Integer 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 TranscribingSideId from <code>its name</code>.
102      *
103      * @param name the name to create the TranscribingSideId from.
104      * @return The enumeration literal named after the 'name' argument
105      */
106     public static TranscribingSideId fromString(String name)
107     {
108         return TranscribingSideId.valueOf(name);
109     }
110 
111     /**
112      * Returns an enumeration literal Integer <code>value</code>.
113      * Required by JAXB2 enumeration implementation
114      *
115      * @return Integer with corresponding value
116      */
117     public Integer value()
118     {
119         return this.enumValue;
120     }
121 
122     /**
123      * Returns an instance of TranscribingSideId from Integer <code>value</code>.
124      * Required by JAXB2 enumeration implementation
125      *
126      * @param value the value to create the TranscribingSideId from.
127      * @return static Enumeration with corresponding value
128      */
129     public static TranscribingSideId fromValue(Integer value)
130     {
131         for (TranscribingSideId enumName: TranscribingSideId.values())
132         {
133             if (enumName.getValue().equals(value))
134             {
135                 return enumName;
136             }
137         }
138         throw new IllegalArgumentException("TranscribingSideId.fromValue(" + value.toString() + ')');
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 Integer 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 Integer.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<Integer> literals()
173     {
174         return TranscribingSideId.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 TranscribingSideId.names;
187     }
188 
189     private static Map<Integer, TranscribingSideId> values = new LinkedHashMap<Integer, TranscribingSideId>(3, 1);
190     private static List<Integer> literals = new ArrayList<Integer>(3);
191     private static List<String> names = new ArrayList<String>(3);
192     private static List<TranscribingSideId> valueList = new ArrayList<TranscribingSideId>(3);
193 
194     /**
195      * Initializes the values.
196      */
197     static
198     {
199         synchronized (TranscribingSideId.values)
200         {
201             TranscribingSideId.values.put(IN.enumValue, IN);
202             TranscribingSideId.values.put(IN_OUT.enumValue, IN_OUT);
203             TranscribingSideId.values.put(OUT.enumValue, OUT);
204         }
205         synchronized (TranscribingSideId.valueList)
206         {
207             TranscribingSideId.valueList.add(IN);
208             TranscribingSideId.valueList.add(IN_OUT);
209             TranscribingSideId.valueList.add(OUT);
210             // For Quadrige3, lists could be reload from configuration (see method 'setValue')
211             //TranscribingSideId.valueList = Collections.unmodifiableList(valueList);
212         }
213         synchronized (TranscribingSideId.literals)
214         {
215             TranscribingSideId.literals.add(IN.enumValue);
216             TranscribingSideId.literals.add(IN_OUT.enumValue);
217             TranscribingSideId.literals.add(OUT.enumValue);
218             // For Quadrige3, lists could be reload from configuration (see method 'setValue')
219             //TranscribingSideId.literals = Collections.unmodifiableList(literals);
220         }
221         synchronized (TranscribingSideId.names)
222         {
223             TranscribingSideId.names.add("IN");
224             TranscribingSideId.names.add("IN_OUT");
225             TranscribingSideId.names.add("OUT");
226             TranscribingSideId.names = Collections.unmodifiableList(names);
227         }
228     }
229     // type-safe-enumeration-object java merge-point
230 }