All Downloads are FREE. Search and download functionalities are using the official Maven repository.

generator.server.javatool.protobuf.main.ProtobufDatesReader.mustache Maven / Gradle / Ivy

There is a newer version: 1.22.0
Show newest version
package {{packageName}}.shared.protobuf.infrastructure.primary;

import com.google.protobuf.Timestamp;
import java.time.Instant;

public final class ProtobufDatesReader {

  private ProtobufDatesReader() {}

  public static Instant readInstant(Timestamp timestamp) {
    if (timestamp == null || timestamp.getSeconds() == 0) {
      return null;
    }

    return Instant.ofEpochSecond(timestamp.getSeconds(), timestamp.getNanos());
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy