package com.nanometer.smartlab.entity.enumtype; import java.util.HashMap; public enum SeeFlag { NORMAL(2, "一般人员"), SOFTER(3, "安全员"),LEADING(11, "系统管理员"), MANAGE(0, "实验室管理员"); private int key; private String text; private SeeFlag(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 (SeeFlag d : SeeFlag.values()) { map.put(d.key, d); } } public static SeeFlag parse(Integer index) { if (map.containsKey(index)) { return map.get(index); } return null; } }