枚举转map
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);
        }
    }
}

 

posted on 2018-11-12 15:53  james-roger  阅读(5849)  评论(0编辑  收藏  举报