package com.zy.core.enums.DevpType; public enum DevpTrayType { NONE(-1,"离线"), EMPTY(1,"空托"), FULL(2,"满托"); public Integer id; public String desc; DevpTrayType(Integer id, String desc) { this.id = id; this.desc = desc; } public static DevpTrayType get(Short id) { if (null == id) { return null; } for (DevpTrayType type : DevpTrayType.values()) { if (type.id.equals(id.intValue())) { return type; } } return NONE; } public static DevpTrayType get(DevpTrayType type) { if (null == type) { return null; } for (DevpTrayType devpTrayType : DevpTrayType.values()) { if (devpTrayType == type) { return devpTrayType; } } return null; } }