package com.gkhy.labRiskManage.config.license; import java.util.HashMap; import java.util.Map; public enum LicenseTypeEnum { INVALID((byte)0,"无效授权"), TRAIL((byte)1,"试用授权"), LIMIT((byte)2,"有限期授权"), LONG_TIME((byte)3,"长期有效授权") ; private Byte type; private String desc; LicenseTypeEnum(Byte type, String desc) { this.type = type; this.desc = desc; } public Byte getType() { return type; } public void setType(Byte type) { this.type = type; } public String getDesc() { return desc; } public void setDesc(String desc) { this.desc = desc; } static Map map; static { map = new HashMap<>(); for (LicenseTypeEnum typeEnum : LicenseTypeEnum.values()) { map.put(typeEnum.type,typeEnum); } } public static LicenseTypeEnum parse(Byte type) { return map.get(type); } }