package com.nanometer.smartlab.entity.enumtype; import java.util.HashMap; public enum Waster { NULL(0, ""),NORMAL(1, "危废处理人员"),MANAGE(2, "危废管理员"); private int key; private String text; private Waster(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 (Waster d : Waster.values()) { map.put(d.key, d); } } public static Waster parse(Integer index) { if (map.containsKey(index)) { return map.get(index); } return null; } }