package com.nanometer.smartlab.entity.enumtype; import java.util.HashMap; public enum StoreType { APPLY(1, "申购"), DIRECTSTORE(2, "直接入库"); private int key; private String text; private StoreType(int key, String text) { this.key = key; this.text = text; } public int getKey() { return key; } public String getText() { return text; } private static HashMap map = new HashMap(); static { for(StoreType d : StoreType.values()){ map.put(d.key, d); } } public static StoreType parse(Integer index) { if(map.containsKey(index)){ return map.get(index); } return null; } }