package com.nanometer.smartlab.entity.enumtype; import java.util.HashMap; public enum EmailSendStatus { UN_SEND(0, "未发送"), SEND_SUCCESS(1, "已发送"), SEND_FAIL(2, "发送失败"); private int key; private String text; private EmailSendStatus(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(EmailSendStatus d : EmailSendStatus.values()){ map.put(d.key, d); } } public static EmailSendStatus parse(Integer index) { if(map.containsKey(index)){ return map.get(index); } return null; } }