com.rosetta.roota.model.E3 Maven / Gradle / Ivy
package com.rosetta.roota.model;
import com.rosetta.model.lib.annotations.RosettaEnum;
import com.rosetta.model.lib.annotations.RosettaEnumValue;
import com.rosetta.model.lib.annotations.RosettaSynonym;
import java.util.Collections;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* @version test
*/
@RosettaEnum("E3")
public enum E3 {
@RosettaSynonym(value = "Fish", source = "Bank_A")
@RosettaEnumValue(value = "ONE") ONE("ONE"),
@RosettaSynonym(value = "Chips", source = "Bank_A")
@RosettaEnumValue(value = "TWO") TWO("TWO")
;
private static Map values;
static {
Map map = new ConcurrentHashMap<>();
for (E3 instance : E3.values()) {
map.put(instance.toDisplayString(), instance);
}
values = Collections.unmodifiableMap(map);
}
private final String rosettaName;
private final String displayName;
E3(String rosettaName) {
this(rosettaName, null);
}
E3(String rosettaName, String displayName) {
this.rosettaName = rosettaName;
this.displayName = displayName;
}
public static E3 fromDisplayName(String name) {
E3 value = values.get(name);
if (value == null) {
throw new IllegalArgumentException("No enum constant with display name \"" + name + "\".");
}
return value;
}
@Override
public String toString() {
return toDisplayString();
}
public String toDisplayString() {
return displayName != null ? displayName : rosettaName;
}
}