zoukankan      html  css  js  c++  java
  • 一个枚举类

    public enum MsgType {
        
        IPCHANGE_MSG(1, "ip地址改变警报"),
        LOCATION_CHANGE_MSG(2,"异地登录警报"),
        KEYWORD_MSG(3, "关键字警报"),
        STATUS_ABNORMAL_MSG(4, "状态异常警报"),
        APPTHRESHOLD_MSG(5, "ip地址改变警报"),
        USERTHRESHOLD_MSG(6, "ip地址改变警报"),
        APPERROE_MSG(7, "ip地址改变警报"),
        USERERROR_MSG(8, "ip地址改变警报");
    
        private Integer type;
        private String desc;
    
        private MsgType(Integer type, String desc) {
            this.type = type;
            this.desc = desc;
        }
    
        public static MsgType getMsgType(Integer code) {
            MsgType status = null;
            switch (code) {
            case 1:
                status = IPCHANGE_MSG;
                break;
            case 2:
                status = LOCATION_CHANGE_MSG;
                break;
            case 3:
                status = KEYWORD_MSG;
                break;
            case 4:
                status = STATUS_ABNORMAL_MSG;
                break;
            case 5:
                status = APPTHRESHOLD_MSG;
                break;
            case 6:
                status = USERTHRESHOLD_MSG;
                break;
            case 7:
                status = APPERROE_MSG;
                break;
            case 8:
                status = USERERROR_MSG;
                break;
            }
            return status;
        }
    
        public static Map<Integer, String> getChoiceMap() {
            HashMap<Integer, String> map = new HashMap<Integer, String>();
            for (MsgType item : MsgType.values()) {
                map.put(item.getType(), item.getDesc());
            }
            return map;
        }
    
        public Integer getType() {
            return type;
        }
    
        public void setType(Integer type) {
            this.type = type;
        }
    
        public String getDesc() {
            return desc;
        }
    
        public void setDesc(String desc) {
            this.desc = desc;
        }
    }
     
  • 相关阅读:
    AtCoder Grand Contest 015 题解
    AtCoder Grand Contest 014 题解
    AtCoder Grand Contest 013 题解
    AtCoder Grand Contest 012 题解
    AtCoder Grand Contest 011 题解
    AtCoder Grand Contest 010 题解
    AtCoder Grand Contest 009 题解
    NOIP2017 Day2 题解
    博客园主题备份
    多项式全家桶
  • 原文地址:https://www.cnblogs.com/duan2/p/7485434.html
Copyright © 2011-2022 走看看