您需要手动执行此操作,方法是在将Integer映射到枚举的类中添加一个静态映射,例如
private static final Map<Integer, PcaplinkType> intToTypeMap = new HashMap<Integer, PcaplinkType>();static { for (PcaplinkType type : PcaplinkType.values()) { intToTypeMap.put(type.value, type); }}public static PcaplinkType fromInt(int i) { PcaplinkType type = intToTypeMap.get(Integer.valueOf(i)); if (type == null) return PcaplinkType.DLT_UNKNOWN; return type;}


