import java.util.HashMap; import java.util.Map; public enum PayType { ALIPAY("支付宝扫码", 15), WEIXIN_PAY("微信扫码", 16) PayType(String name, int value) { this.name = name; this.value = value; } public int value; public String name; public static Map<String, PayType> typeMap = new HashMap<String, PayType>(); static { PayType[] types = PayType.values(); for (PayType type : types) { typeMap.put(String.valueOf(type.value), type); } } }