package com.iformall.enums;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by Stormeye on 2018/08/09.
 */
public enum EnumCacheKey {

    C_INDEX_PAGE_LIST(0, "couponChannelList_"),

    ;
    private static Map<Integer,EnumCacheKey> map = new HashMap<Integer,EnumCacheKey>();
    static {
        for (EnumCacheKey value : values()) {
            map.put(value.code, value);
        }
    }

    public static EnumCacheKey getEnum(Integer code) {
        if (code == null) return null;
        return map.get(code);
    }

    public static String getEnumMessage(Integer code) {
        if (code == null) return null;
        if (map.get(code) == null)
            return null;
        return map.get(code).getMessage();
    }

    private Integer code;
    private String message;


    EnumCacheKey(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }
}
