Skip to content
Advertisement

Tag: protocol-buffers

google protobuffer how to define list of lists in proto file?

I have a class with a list of lists field as below: how to define it in a proto file? Answer You can declare your own “types” in proto files called message. If you’d like to declare a list you should use repeated keyword. Combining those two gives us: You can then use ListOfListsOfStrings message in your proto were appropriate.

How to initialize Google protocol buffers Timestamp in Java?

Google protocol buffers (3.0.0-beta2) offers the well-known type Timestamp. The documentation describes the initialization in Java using System.currentTimeMillis() as following: Is there an alternative way in the recent Java 8? Answer Starting with Java 8, there is the new Date/Time-API which makes this more appealing to the reader using java.time.Instant The result should be the same concerning precision.

Advertisement