package com.gkhy.safePlatform.account.enums.schedule; import java.util.HashMap; import java.util.Map; public enum GroupStrategyCycleTypeEnum { YEAR((byte) 1, "年"), MONTH((byte) 2, "月"), WEEK((byte) 3, "周"), ; GroupStrategyCycleTypeEnum(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 (GroupStrategyCycleTypeEnum groupStrategyCycleTypeEnum : GroupStrategyCycleTypeEnum.values()) { map.put(groupStrategyCycleTypeEnum.code, groupStrategyCycleTypeEnum); } } public static GroupStrategyCycleTypeEnum parse(Byte code) { return map.get(code); } }