本文整理汇总了Java中com.google.protobuf.util.Timestamps.toString方法的典型用法代码示例。如果您正苦于以下问题:Java Timestamps.toString方法的具体用法?Java Timestamps.toString怎么用?Java Timestamps.toString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.protobuf.util.Timestamps
的用法示例。
在下文中一共展示了Timestamps.toString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: valueToTimestamp
import com.google.protobuf.util.Timestamps; //导入方法依赖的package包/类
@Nullable
private String valueToTimestamp(Value v) {
boolean isTimestampValue = v.getValueTypeCase().equals(ValueTypeCase.TIMESTAMP_VALUE);
if (!isTimestampValue) {
return null;
}
return Timestamps.toString(v.getTimestampValue());
}
示例2: assertAtLevel
import com.google.protobuf.util.Timestamps; //导入方法依赖的package包/类
private void assertAtLevel(Level level) {
final LoggingObserver<Object> observer = getObserver(level);
assertNotNull(observer);
// Since we're in the tests mode `Environment` returns `SubstituteLogger` instance.
final SubstituteLogger log = (SubstituteLogger) observer.log();
// Restrict the queue size only to the number of calls we want to make.
final Queue<SubstituteLoggingEvent> queue = Queues.newArrayBlockingQueue(3);
log.setDelegate(new EventRecodingLogger(log, queue));
SubstituteLoggingEvent loggingEvent;
final String value = newUuid();
observer.onNext(value);
loggingEvent = queue.poll();
assertNotNull(loggingEvent);
assertLogLevel(loggingEvent, level);
assertContains(loggingEvent, value);
assertContains(loggingEvent, "onNext");
final Timestamp currentTime = Time.getCurrentTime();
final String timeStr = Timestamps.toString(currentTime);
observer.onNext(currentTime);
loggingEvent = queue.poll();
assertNotNull(loggingEvent);
assertLogLevel(loggingEvent, level);
assertContains(loggingEvent, timeStr);
observer.onCompleted();
loggingEvent = queue.poll();
assertNotNull(loggingEvent);
assertLogLevel(loggingEvent, level);
assertContains(loggingEvent, "onCompleted");
}
示例3: logItem
import com.google.protobuf.util.Timestamps; //导入方法依赖的package包/类
private static StringValue logItem(String digitalPart) {
final String str =
Timestamps.toString(Time.getCurrentTime())
+ " - "
+ digitalPart;
return StringValue.newBuilder()
.setValue(str)
.build();
}
示例4: convert
import com.google.protobuf.util.Timestamps; //导入方法依赖的package包/类
@Override
public String convert(MessageOrBuilder message) throws IOException {
Timestamp value = Timestamp.parseFrom(toByteString(message));
return ("\"" + Timestamps.toString(value) + "\"");
}