枚舉轉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);
        }
    }
}

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM