public enum SS{ S_STATUS_UP(1,"系统上架","系统上架"), S_STATUS_DOWN(0,"系统下架","系统下架"), S_SKUCEHCK_DOWN(3,"风控下架","风控下架"), S_SKUCHECK_UP(4,"风控上架","风控上架"); /** * CODE值 */ private Integer code; /** * 缩写 */ private String desc; /** * 页面展示 */ private String showName; SS(Integer code, String desc, String showName) { this.code = code; this.desc = desc; this.showName = showName; } public Integer getCode() { return code; } public String getDesc() { return desc; } public String getShowName() { return showName; } private static final Map<Integer,SS> map = new HashMap<Integer, SS>(); static { for(SS ss:SS.values()){ map.put(ss.getCode(),ss); } } public static SSget(Integer code){ return map.get(code); } @Override public String toString() { return new StringBuilder().append(this.getCode()).append(":").append(this.getDesc()).toString(); } }
枚举类例子
最新推荐文章于 2024-09-17 12:02:36 发布