mirror of
https://github.com/tiennm99/zfoo.git
synced 2026-08-21 08:27:11 +00:00
perf[protocol]: fix string default value
This commit is contained in:
@@ -65,6 +65,9 @@ public class ProtocolManager {
|
||||
|
||||
/**
|
||||
* deserialization a packet from the buffer
|
||||
* <p>
|
||||
* byte[] convert to ByteBuf using Unpooled.wrappedBuffer(byte[]) in netty
|
||||
* ByteBuf convert to byte[] using ByteBufUtils.readAllBytes(ByteBuf) in zfoo
|
||||
*/
|
||||
public static Object read(ByteBuf buffer) {
|
||||
return protocols[ByteBufUtils.readShort(buffer)].read(buffer);
|
||||
@@ -81,6 +84,7 @@ public class ProtocolManager {
|
||||
public static ProtocolModule moduleByProtocolId(short id) {
|
||||
return modules[protocols[id].module()];
|
||||
}
|
||||
|
||||
public static ProtocolModule moduleByProtocol(Class<?> clazz) {
|
||||
return moduleByProtocolId(protocolId(clazz));
|
||||
}
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ public class EnhanceStringSerializer implements IEnhanceSerializer {
|
||||
@Override
|
||||
public String defaultValue(StringBuilder builder, Field field, IFieldRegistration fieldRegistration) {
|
||||
var result = "result" + GenerateProtocolFile.index.getAndIncrement();
|
||||
builder.append(StringUtils.format("String {} = \"\"", result));
|
||||
builder.append(StringUtils.format("String {} = \"\";", result));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user