package com.gkhy.safePlatform.account.enums; import java.util.HashMap; import java.util.Map; public enum LeaveTypeEnum { //休假类型 WEEKLY_PUBLIC_HOLIDAYS((byte)0,"每周公休假日"), NATIONAL_LEGAL_HOLIDAYS((byte)1,"国家法定节假日"), CUSTOM_REST_DAYS((byte)2,"自定义休息日"); LeaveTypeEnum(byte code, String value) { this.code = code; this.value = value; } byte code; String value; public byte getCode() { return code; } public String getValue() { return value; } static Map map; static { map = new HashMap<>(); for (LeaveTypeEnum leaveTypeEnum : LeaveTypeEnum.values()) { map.put(leaveTypeEnum.getCode(), leaveTypeEnum); } } public static LeaveTypeEnum parse(Byte code) { return map.get(code); } }