jhunters / jprotobuf

A useful utility library for java programmer using google protobuf
Apache License 2.0
893 stars 283 forks source link

Compatible with Google Protobuf Messages? #160

Open tangmin823 opened 3 years ago

tangmin823 commented 3 years ago

Thanks for sharing this excellent utility library! I hava two questions to make sure: Dose this tool's message protocol compatible with Google Protobuf Messages? Could this tool generate .proto file from complex java class code?

In addition, while we using this library, it still generate .proto file, but I would think there's no need, Could you transform java pojo to protobuff directly?

Look fwd to your reply, thanks!

jhunters commented 3 years ago

Here are the answers. Dose this tool's message protocol compatible with Google Protobuf Messages? yes. we have complete test cases to test compatible with google protobuf proto2 and proto3. Could this tool generate .proto file from complex java class code? we think yes! we have use this in lots of real online products. and we met one case will generate more than 300 messages include nested types and enumerations.

We no need proto files at all by using jprotobuf. To generate proto files is convient to someone to share proto file but do not like to write it again. It could be closed by setting maven configuration. pls visit https://github.com/jhunters/jprotobuf/blob/master/Document.md to set “false

sorry for my poor english. thanks!

tangmin823 commented 3 years ago

Wonderful, It's ok! This library supports null as default value, right? but google protobuffer dosen't, you know. Default Values

jhunters commented 3 years ago

Here is some information about default values usage: by primity type, eg int, long, short etc, the default value is compatible with java spec. For enums is 0. This is same to google protobuf. by object type, eg Integer, Long, Short ect. These support null as default value.

thanks!