package com.qianwen.smartman.common.enums; public enum WorkstationParamStateEnum { COMM_FAILURE(0, "通讯失败, 网关与机床通讯失败 = 网关在线,机床离线"), BAD(1, "无效数据"), ERROR(2, "错误数据"), INITIAL(3, "通讯已经建立,但是没有进行第一次采集之前的默认值"), ADDRESS_BAD(4, "无效地址"), PROPERTY_BAD(5, "无效属性"), Good(15, "有效数据"); private final Integer type; private final String description; WorkstationParamStateEnum(final Integer type, final String description) { this.type = type; this.description = description; } public Integer getType() { return this.type; } public String getDescription() { return this.description; } public static WorkstationParamStateEnum of(Integer messageType) { if (messageType == null) { return null; } WorkstationParamStateEnum[] values = values(); for (WorkstationParamStateEnum messageEnum : values) { if (messageEnum.type.equals(messageType)) { return messageEnum; } } return null; } public boolean isEqual(Integer type) { return this.type.equals(type); } }