ProtobufCodecBuilder<DocApiT, ProtoT> decoder(Parser<ProtoT> parser, Function<ProtoT, DocApiT> fn) {
            if (decoderFn != null) {
                throw new IllegalArgumentException("Decoder already set");
            }
            decoderFn = (buf) -> {
                try {
                    var protoObj = parser.parseFrom(buf.getBuf().getByteBuffer());
                    return fn.apply(protoObj);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            };
            return this;
        }
Implementation of MessageBus message request/response serialization built around Protocol Buffers.
documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/RoutableFactories80.java