Skip to content

Commit e61c325

Browse files
committed
feat: introduce java.time methods
1 parent 30963e1 commit e61c325

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

google-cloud-logging/src/main/java/com/google/cloud/logging/HttpRequest.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,15 @@
1616

1717
package com.google.cloud.logging;
1818

19+
import static com.google.api.gax.util.TimeConversionUtils.toJavaTimeDuration;
20+
1921
import com.google.api.core.ApiFunction;
2022
import com.google.cloud.StringEnumType;
2123
import com.google.cloud.StringEnumValue;
2224
import com.google.common.base.MoreObjects;
2325
import com.google.errorprone.annotations.CanIgnoreReturnValue;
2426
import java.io.Serializable;
2527
import java.util.Objects;
26-
import org.threeten.bp.Duration;
2728

2829
/**
2930
* Objects of this class represent information about the (optional) HTTP request associated with a
@@ -51,7 +52,7 @@ public final class HttpRequest implements Serializable {
5152
private final boolean cacheHit;
5253
private final boolean cacheValidatedWithOriginServer;
5354
private final Long cacheFillBytes;
54-
private final Duration latency;
55+
private final java.time.Duration latency;
5556

5657
/** The HTTP request method. */
5758
public static final class RequestMethod extends StringEnumValue {
@@ -112,7 +113,7 @@ public static final class Builder {
112113
private boolean cacheHit;
113114
private boolean cacheValidatedWithOriginServer;
114115
private Long cacheFillBytes;
115-
private Duration latency;
116+
private java.time.Duration latency;
116117

117118
Builder() {}
118119

@@ -258,12 +259,19 @@ public Builder setCacheFillBytes(long cacheFillBytes) {
258259
return this;
259260
}
260261

262+
/**
263+
* This method
264+
*/
265+
public Builder setLatency(org.threeten.bp.Duration latency) {
266+
return setLatencyDuration(toJavaTimeDuration(latency));
267+
}
268+
261269
/**
262270
* Sets the latency on the server, from the time the request was received until the response was
263271
* sent.
264272
*/
265273
@CanIgnoreReturnValue
266-
public Builder setLatency(Duration latency) {
274+
public Builder setLatencyDuration(java.time.Duration latency) {
267275
this.latency = latency;
268276
return this;
269277
}

0 commit comments

Comments
 (0)