Is there a tool or library that can map a Protobuff object to a POJO. I would like to have the pojo implement other interfaces that I can not with the ProtoBuff object. Or would I have to manually do this conversion?
Maybe too late, but you can try protobuf-converter library. It is easy to use.
Convert POJO object to related protobuf message:
POJOClass pojoInstance = new POJOClass();
...
ProtobufClass protoInstance = Converter.create().toProtobuf(ProtobufClass.class, pojoInstance );
Code for backward conversion:
POJOClass pojoInstance = Converter.create().toDomain(POJOClass.class, protoInstance);
Take a look at ProtoStuff. I think it will do what you want.
I believe that you will want to use the "java-bean" compiler.
Edit: Changed the link.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With