package com.nanometer.smartlab.entity.enumtype; import java.util.HashMap; public enum Type { //3为 危化品试剂 REFUSE(0, "耗材"), PENDING_APPROVAL(1, "试剂"); private int key; private String text; private Type(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(Type d : Type.values()){ map.put(d.key, d); } } public static Type parse(Integer index) { if(map.containsKey(index)){ return map.get(index); } return null; } }