package com.nanometer.smartlab.entity.enumtype; import java.util.HashMap; public enum ArrivalStatus { PERSONAL(0, "领用"), WAREHOUSE(1, "入库"), LABORATORY(2, "存入"), SCRAP(3, "报废"), NOREGISTER(-1, "领用待入库"); private int key; private String text; private ArrivalStatus(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(ArrivalStatus d : ArrivalStatus.values()){ map.put(d.key, d); } } public static ArrivalStatus parse(Integer index) { if(map.containsKey(index)){ return map.get(index); } return null; } }