All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.rosetta.testconditional.model.TestEnum Maven / Gradle / Ivy

There is a newer version: 11.25.1
Show newest version
package com.rosetta.testconditional.model;

import com.rosetta.model.lib.annotations.RosettaEnum;
import com.rosetta.model.lib.annotations.RosettaEnumValue;
import com.rosetta.model.lib.annotations.RosettaSynonym;
import com.rosetta.testconditional.model.TestEnum;
import java.util.Collections;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;


/**
 * @version test
 */
@RosettaEnum("TestEnum")
public enum TestEnum {

	@RosettaSynonym(value = "foo", source = "Bank_A")
	@RosettaEnumValue(value = "FOO") 
	FOO("FOO", null),
	
	@RosettaSynonym(value = "bar", source = "Bank_A")
	@RosettaEnumValue(value = "BAR") 
	BAR("BAR", null)
;
	private static Map values;
	static {
        Map map = new ConcurrentHashMap<>();
		for (TestEnum instance : TestEnum.values()) {
			map.put(instance.toDisplayString(), instance);
		}
		values = Collections.unmodifiableMap(map);
    }

	private final String rosettaName;
	private final String displayName;

	TestEnum(String rosettaName, String displayName) {
		this.rosettaName = rosettaName;
		this.displayName = displayName;
	}

	public static TestEnum fromDisplayName(String name) {
		TestEnum 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;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy