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