用于gRPC / protobuf的Java IDL(Protocl缓冲区) [英] Java IDL for gRPC / protobuf (Protocl Buffers)
问题描述
是否可以使用Java定义协议缓冲区?
Is it possible to define Protocol Buffers using Java?
这不是
service Greeter {
rpc SayHello (HelloRequest) returns (HelloReply) {}
}
我想要
public interface Greeter {
@Grpc
HelloReply sayHello (HelloRequest req);
}
@GrpcMessage()
public class HelloReply{
@GrpcField(1)
string name;
}
这是我的POJO上的Hibernate / JPA注释,而不是生成的堆代码。
That is annotation like Hibernate/JPA over my POJO, instead of heaps of generated code.
我只能找到Protocol Buffers Dynamic Schema https://github.com/os72/protobuf-dynamic
I only could find Protocol Buffers Dynamic Schema https://github.com/os72/protobuf-dynamic
推荐答案
看看protostuff:< a href =https://github.com/protostuff/protostuff =nofollow noreferrer> https://github.com/protostuff/protostuff
它支持你想要的protobuf(虽然不适合grpc,也许它可以增强)
Have a look at protostuff: https://github.com/protostuff/protostuff It supports what you want for protobuf (although not for grpc, perhaps it can be enhanced)
这篇关于用于gRPC / protobuf的Java IDL(Protocl缓冲区)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!