mxsm commented on issue #5742:
URL: https://github.com/apache/rocketmq/issues/5742#issuecomment-1360649821
Hi @xiaorongZheng SerializeType#valueof paramter is string that this method
is enum method, you can custom a enum has the valueof (String xxx) method. So
this code is correct.
```java
public static SerializeType valueOf(byte code) {
for (SerializeType serializeType : SerializeType.values()) {
if (serializeType.getCode() == code) {
return serializeType;
}
}
return null;
}
```
The above code was used in the following place.
```java
//RemotingCommand#getProtocolType
public static SerializeType getProtocolType(int source) {
return SerializeType.valueOf((byte) ((source >> 24) & 0xFF));
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]