package com.nanometer.smartlab.entity.enumtype; import java.util.*; public enum ReplaceDictType { factory (1, "厂家"), specifications(2, "规格"), packing(3, "包装"); private int key; private String type; ReplaceDictType(int key, String type){ this.key = key; this.type = type; } public int getKey() { return key; } public String getType() { return type; } private static HashMap map = new HashMap(); static { for(ReplaceDictType d : ReplaceDictType.values()){ map.put(d.key, d); } } public static ReplaceDictType parse(Integer index) { if(map.containsKey(index)){ return map.get(index); } return null; } }