NETTY-406 ProtobufEncoder should also support Message.Builder
* Added support for Message.Builder
This commit is contained in:
parent
e2655f3c38
commit
b9ef785b5b
@ -78,9 +78,12 @@ public class ProtobufEncoder extends OneToOneEncoder {
|
||||
@Override
|
||||
protected Object encode(
|
||||
ChannelHandlerContext ctx, Channel channel, Object msg) throws Exception {
|
||||
if (!(msg instanceof MessageLite)) {
|
||||
return msg;
|
||||
if (msg instanceof MessageLite) {
|
||||
return wrappedBuffer(((MessageLite) msg).toByteArray());
|
||||
}
|
||||
return wrappedBuffer(((MessageLite) msg).toByteArray());
|
||||
if (msg instanceof MessageLite.Builder) {
|
||||
return wrappedBuffer(((MessageLite.Builder) msg).build().toByteArray());
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user