private DurationRule(Duration duration) { this.builder = com.google.protobuf.Duration.newBuilder() .setSeconds(duration.getSeconds()) .setNanos(duration.getNano()); }
1000, ((DurationRule) columnFamilyById.get("mf2").getGCRule()).getMaxAge().getSeconds()); assertEquals( 20000, ((DurationRule) columnFamilyById.get("mf2").getGCRule()).getMaxAge().getNano()); assertEquals( 2, ((IntersectionRule) columnFamilyById.get("mf3").getGCRule()).getRulesList().size());
com.google.protobuf.Duration.newBuilder() .setSeconds(latency.getSeconds()) .setNanos(latency.getNano()) .build());
/** * Returns a copy of this duration with the specified duration added. * <p> * This instance is immutable and unaffected by this method call. * * @param duration the duration to add, positive or negative, not null * @return a {@code Duration} based on this duration with the specified duration added, not null * @throws ArithmeticException if numeric overflow occurs */ public Duration plus(Duration duration) { return plus(duration.getSeconds(), duration.getNano()); }
/** * Returns a copy of this duration with the specified duration added. * <p> * This instance is immutable and unaffected by this method call. * * @param duration the duration to add, positive or negative, not null * @return a {@code Duration} based on this duration with the specified duration added, not null * @throws ArithmeticException if numeric overflow occurs */ public Duration plus(Duration duration) { return plus(duration.getSeconds(), duration.getNano()); }
@Override public void serialize(Duration duration, JsonGenerator generator, SerializerProvider provider) throws IOException { if (useTimestamp(provider)) { if (provider.isEnabled(SerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS)) { generator.writeNumber(DecimalUtils.toBigDecimal( duration.getSeconds(), duration.getNano() )); } else { generator.writeNumber(duration.toMillis()); } } else { // Does not look like we can make any use of DateTimeFormatter here? generator.writeString(duration.toString()); } }
private DurationRule(Duration duration) { this.builder = com.google.protobuf.Duration.newBuilder() .setSeconds(duration.getSeconds()) .setNanos(duration.getNano()); }
/** * Returns a copy of this duration with the specified duration subtracted. * <p> * This instance is immutable and unaffected by this method call. * * @param duration the duration to subtract, positive or negative, not null * @return a {@code Duration} based on this duration with the specified duration subtracted, not null * @throws ArithmeticException if numeric overflow occurs */ public Duration minus(Duration duration) { long secsToSubtract = duration.getSeconds(); int nanosToSubtract = duration.getNano(); if (secsToSubtract == Long.MIN_VALUE) { return plus(Long.MAX_VALUE, -nanosToSubtract).plus(1, 0); } return plus(-secsToSubtract, -nanosToSubtract); }
/** * Returns a copy of this duration with the specified duration subtracted. * <p> * This instance is immutable and unaffected by this method call. * * @param duration the duration to subtract, positive or negative, not null * @return a {@code Duration} based on this duration with the specified duration subtracted, not null * @throws ArithmeticException if numeric overflow occurs */ public Duration minus(Duration duration) { long secsToSubtract = duration.getSeconds(); int nanosToSubtract = duration.getNano(); if (secsToSubtract == Long.MIN_VALUE) { return plus(Long.MAX_VALUE, -nanosToSubtract).plus(1, 0); } return plus(-secsToSubtract, -nanosToSubtract); }
return plusSeconds(duration.getSeconds()).plusNanos(duration.getNano());
return plusSeconds(duration.getSeconds()).plusNanos(duration.getNano());
com.google.protobuf.Duration.newBuilder() .setSeconds(latency.getSeconds()) .setNanos(latency.getNano()) .build());