解决方案:枚举类根据key值获取value值。

版权声明:转载需说明出处。 https://blog.csdn.net/en_joker/article/details/85044179

下面是一个根据key值获取枚举类相应的value值的方法。

	public static String getValue(String code) {
		for (TestEnum ele : values()) {
			if(ele.getCode().equals(code)) return ele.getValue();
		}
		return null;
	}

猜你喜欢

转载自blog.csdn.net/en_joker/article/details/85044179