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