Is it possible to define Protocol Buffers using Java?
That is instead of
service Greeter {
rpc SayHello (HelloRequest) returns (HelloReply) {}
}
I would like to have
public interface Greeter {
@Grpc
HelloReply sayHello (HelloRequest req);
}
@GrpcMessage()
public class HelloReply{
@GrpcField(1)
string name;
}
That is annotation like Hibernate/JPA over my POJO, instead of heaps of generated code.
I only could find Protocol Buffers Dynamic Schema https://github.com/os72/protobuf-dynamic
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)