提交 85596b74 编写于 作者: 如梦技术's avatar 如梦技术 🐛

统一规范代码

上级 a3b06769
......@@ -56,23 +56,24 @@ public enum MqttDisconnectReasonCode implements MqttReasonCode {
SUBSCRIPTION_IDENTIFIERS_NOT_SUPPORTED((byte) 0xA1),
WILDCARD_SUBSCRIPTIONS_NOT_SUPPORTED((byte) 0xA2);
private static final MqttDisconnectReasonCode[] VALUES = new MqttDisconnectReasonCode[0xA3];
static {
ReasonCodeUtils.fillValuesByCode(VALUES, values());
}
private final byte byteValue;
MqttDisconnectReasonCode(byte byteValue) {
this.byteValue = byteValue;
}
private final byte byteValue;
@Override
public byte value() {
return byteValue;
}
private static final MqttDisconnectReasonCode[] VALUES = new MqttDisconnectReasonCode[0xA3];
static {
ReasonCodeUtils.fillValuesByCode(VALUES, values());
}
public static MqttDisconnectReasonCode valueOf(byte b) {
return ReasonCodeUtils.codeLoopUp(VALUES, b, "DISCONNECT");
}
......
......@@ -36,18 +36,18 @@ public enum MqttPubAckReasonCode implements MqttReasonCode {
QUOTA_EXCEEDED((byte) 0x97),
PAYLOAD_FORMAT_INVALID((byte) 0x99);
MqttPubAckReasonCode(byte byteValue) {
this.byteValue = byteValue;
}
private final byte byteValue;
private static final MqttPubAckReasonCode[] VALUES = new MqttPubAckReasonCode[0x9A];
static {
ReasonCodeUtils.fillValuesByCode(VALUES, values());
}
private final byte byteValue;
MqttPubAckReasonCode(byte byteValue) {
this.byteValue = byteValue;
}
public static MqttPubAckReasonCode valueOf(byte b) {
return ReasonCodeUtils.codeLoopUp(VALUES, b, "PUBACK");
}
......
......@@ -29,12 +29,12 @@ public enum MqttPubCompReasonCode implements MqttReasonCode {
SUCCESS((byte) 0x0),
PACKET_IDENTIFIER_NOT_FOUND((byte) 0x92);
private final byte byteValue;
MqttPubCompReasonCode(byte byteValue) {
this.byteValue = byteValue;
}
private final byte byteValue;
@Override
public byte value() {
return byteValue;
......
......@@ -36,12 +36,18 @@ public enum MqttPubRecReasonCode implements MqttReasonCode {
QUOTA_EXCEEDED((byte) 0x97),
PAYLOAD_FORMAT_INVALID((byte) 0x99);
MqttPubRecReasonCode(byte byteValue) {
this.byteValue = byteValue;
private static final MqttPubRecReasonCode[] VALUES = new MqttPubRecReasonCode[0x9A];
static {
ReasonCodeUtils.fillValuesByCode(VALUES, values());
}
private final byte byteValue;
MqttPubRecReasonCode(byte byteValue) {
this.byteValue = byteValue;
}
@Override
public byte value() {
return byteValue;
......@@ -52,12 +58,6 @@ public enum MqttPubRecReasonCode implements MqttReasonCode {
return Byte.toUnsignedInt(byteValue) >= Byte.toUnsignedInt(UNSPECIFIED_ERROR.byteValue);
}
private static final MqttPubRecReasonCode[] VALUES = new MqttPubRecReasonCode[0x9A];
static {
ReasonCodeUtils.fillValuesByCode(VALUES, values());
}
public static MqttPubRecReasonCode valueOf(byte b) {
return ReasonCodeUtils.codeLoopUp(VALUES, b, "PUBREC");
}
......
......@@ -29,12 +29,12 @@ public enum MqttPubRelReasonCode implements MqttReasonCode {
SUCCESS((byte) 0x0),
PACKET_IDENTIFIER_NOT_FOUND((byte) 0x92);
private final byte byteValue;
MqttPubRelReasonCode(byte byteValue) {
this.byteValue = byteValue;
}
private final byte byteValue;
@Override
public byte value() {
return byteValue;
......
......@@ -38,12 +38,12 @@ public enum MqttSubAckReasonCode implements MqttReasonCode {
SUBSCRIPTION_IDENTIFIERS_NOT_SUPPORTED((byte) 0xA1),
WILDCARD_SUBSCRIPTIONS_NOT_SUPPORTED((byte) 0xA2);
private final byte byteValue;
MqttSubAckReasonCode(byte byteValue) {
this.byteValue = byteValue;
}
private final byte byteValue;
@Override
public byte value() {
return byteValue;
......
......@@ -34,12 +34,12 @@ public enum MqttUnsubAckReasonCode implements MqttReasonCode {
TOPIC_FILTER_INVALID((byte) 0x8F),
PACKET_IDENTIFIER_IN_USE((byte) 0x91);
private final byte byteValue;
MqttUnsubAckReasonCode(byte byteValue) {
this.byteValue = byteValue;
}
private final byte byteValue;
@Override
public byte value() {
return byteValue;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册