package com.gkhy.safePlatform.incidentManage.enums;
|
|
import java.util.HashMap;
|
import java.util.Map;
|
|
public enum AccidentReportGradeEnum {
|
|
|
GRADE_ONE((byte) 1, "一级"),
|
GRADE_TWO((byte) 2, "二级"),
|
GRADE_THREE((byte) 3, "三级"),
|
GRADE_FOUR((byte) 4, "四级");
|
|
|
private Byte code;
|
private String value;
|
|
AccidentReportGradeEnum(Byte code, String value) {
|
this.code = code;
|
this.value = value;
|
}
|
|
public Byte getCode() {
|
return code;
|
}
|
|
public void setCode(Byte code) {
|
this.code = code;
|
}
|
|
public String getValue() {
|
return value;
|
}
|
|
public void setValue(String value) {
|
this.value = value;
|
}
|
|
// 转换成为 MAP<Byte, String>, 对外提供查询和遍历功能
|
public static Map<Byte, AccidentReportGradeEnum> toMap() {
|
Map<Byte, AccidentReportGradeEnum> map = new HashMap();
|
for (AccidentReportGradeEnum accidentExpressEnum : AccidentReportGradeEnum.values()) {
|
map.put(accidentExpressEnum.getCode(), accidentExpressEnum);
|
}
|
return map;
|
}
|
public static AccidentReportGradeEnum getByCode(Byte code){
|
return toMap().get(code);
|
}
|
}
|