StringBuilder toString(StringBuilder b) { // TODO(user): Convert all internal toString(StringBuilder) methods to return StringBuilder. switch (mode) { case STRONG: return b.append("strong"); case READ_TIMESTAMP: return b.append("exact_timestamp: ").append(timestamp.toString()); case MIN_READ_TIMESTAMP: return b.append("min_read_timestamp: ").append(timestamp.toString()); case EXACT_STALENESS: return b.append("exact_staleness: ").append(Durations.toString(staleness)); case MAX_STALENESS: return b.append("max_staleness: ").append(Durations.toString(staleness)); default: throw new AssertionError("Unexpected mode: " + mode); } }
@Override public void serialize( Duration duration, JsonGenerator generator, SerializerProvider serializerProvider ) throws IOException { generator.writeString(Durations.toString(duration)); } }
/** * Convert Duration to string format. The string format will contains 3, 6, * or 9 fractional digits depending on the precision required to represent * the exact Duration value. For example: "1s", "1.010s", "1.000000100s", * "-3.100s" The range that can be represented by Duration is from * -315,576,000,000 to +315,576,000,000 inclusive (in seconds). * * @return The string representation of the given duration. * @throws IllegalArgumentException if the given duration is not in the valid * range. * @deprecated Use {@link Durations#toString} instead. */ @Deprecated public static String toString(Duration duration) { return Durations.toString(duration); }
StringBuilder toString(StringBuilder b) { // TODO(user): Convert all internal toString(StringBuilder) methods to return StringBuilder. switch (mode) { case STRONG: return b.append("strong"); case READ_TIMESTAMP: return b.append("exact_timestamp: ").append(timestamp.toString()); case MIN_READ_TIMESTAMP: return b.append("min_read_timestamp: ").append(timestamp.toString()); case EXACT_STALENESS: return b.append("exact_staleness: ").append(Durations.toString(staleness)); case MAX_STALENESS: return b.append("max_staleness: ").append(Durations.toString(staleness)); default: throw new AssertionError("Unexpected mode: " + mode); } }
/** Prints google.protobuf.Duration */ private void printDuration(MessageOrBuilder message) throws IOException { Duration value = Duration.parseFrom(toByteString(message)); generator.print("\"" + Durations.toString(value) + "\""); }
/** Prints google.protobuf.Duration */ private void printDuration(MessageOrBuilder message) throws IOException { Duration value = Duration.parseFrom(toByteString(message)); generator.print("\"" + Durations.toString(value) + "\""); }
/** Prints google.protobuf.Duration */ private void printDuration(MessageOrBuilder message) throws IOException { Duration value = Duration.parseFrom(toByteString(message)); generator.print("\"" + Durations.toString(value) + "\""); }
/** Prints google.protobuf.Duration */ private void printDuration(MessageOrBuilder message) throws IOException { Duration value = Duration.parseFrom(toByteString(message)); generator.print("\"" + Durations.toString(value) + "\""); }