maja :
I'm using protobuf, and one of my message uses the google.protobuf.Timestamp
type.
When generating the Java-Code, the resulting protobuf classes use com.google.protobuf.Timestamp
.
Is there a way to tell protobuf to use the new Java 8 types (e.g. time.Instant
) instead? I don't want the type conversion clutter my code, everywhere I use protobuf. Ideally, it is done inside the generated code itself.
Louis Thibault :
Instant instant = Instant.ofEpochSecond(timestamp.getSeconds(), timestamp.getNanos());
Guess you like
Origin http://10.200.1.11:23101/article/api/json?id=474332&siteId=1