diff --git a/google-cloud-core/src/main/java/com/google/cloud/MonitoredResource.java b/google-cloud-core/src/main/java/com/google/cloud/MonitoredResource.java index e7e1f9f7e442..66cd15ce1eec 100644 --- a/google-cloud-core/src/main/java/com/google/cloud/MonitoredResource.java +++ b/google-cloud-core/src/main/java/com/google/cloud/MonitoredResource.java @@ -68,8 +68,7 @@ public static class Builder { */ @Deprecated public Builder type(String type) { - this.type = type; - return this; + return setType(type); } /** @@ -89,8 +88,7 @@ public Builder setType(String type) { */ @Deprecated public Builder labels(Map labels) { - this.labels = new HashMap<>(checkNotNull(labels)); - return this; + return setLabels(labels); } /** @@ -136,7 +134,7 @@ public MonitoredResource build() { */ @Deprecated public String type() { - return type; + return getType(); } /** @@ -155,7 +153,7 @@ public String getType() { */ @Deprecated public Map labels() { - return labels; + return getLabels(); } /** @@ -211,7 +209,7 @@ public Builder toBuilder() { */ @Deprecated public static Builder builder(String type) { - return new Builder(type); + return newBuilder(type); } /** diff --git a/google-cloud-core/src/main/java/com/google/cloud/MonitoredResourceDescriptor.java b/google-cloud-core/src/main/java/com/google/cloud/MonitoredResourceDescriptor.java index 012b5c49cd0c..ebee6544df4a 100644 --- a/google-cloud-core/src/main/java/com/google/cloud/MonitoredResourceDescriptor.java +++ b/google-cloud-core/src/main/java/com/google/cloud/MonitoredResourceDescriptor.java @@ -122,7 +122,7 @@ static ValueType fromPb(com.google.api.LabelDescriptor.ValueType typePb) { */ @Deprecated public String key() { - return key; + return getKey(); } /** @@ -137,7 +137,7 @@ public String getKey() { */ @Deprecated public ValueType valueType() { - return valueType; + return getValueType(); } /** @@ -153,7 +153,7 @@ public ValueType getValueType() { */ @Deprecated public String description() { - return description; + return getDescription(); } /** @@ -263,7 +263,7 @@ MonitoredResourceDescriptor build() { */ @Deprecated public String type() { - return type; + return getType(); } /** @@ -280,7 +280,7 @@ public String getType() { */ @Deprecated public String name() { - return name; + return getName(); } /** @@ -298,7 +298,7 @@ public String getName() { */ @Deprecated public String displayName() { - return displayName; + return getDisplayName(); } /** @@ -316,7 +316,7 @@ public String getDisplayName() { */ @Deprecated public String description() { - return description; + return getDescription(); } /** @@ -334,7 +334,7 @@ public String getDescription() { */ @Deprecated public List labels() { - return labels; + return getLabels(); } /** diff --git a/google-cloud-logging/src/main/java/com/google/cloud/logging/HttpRequest.java b/google-cloud-logging/src/main/java/com/google/cloud/logging/HttpRequest.java index 5bb53b85a660..efac2760d895 100644 --- a/google-cloud-logging/src/main/java/com/google/cloud/logging/HttpRequest.java +++ b/google-cloud-logging/src/main/java/com/google/cloud/logging/HttpRequest.java @@ -99,8 +99,7 @@ public static final class Builder { */ @Deprecated public Builder requestMethod(RequestMethod requestMethod) { - this.requestMethod = requestMethod; - return this; + return setRequestMethod(requestMethod); } /** @@ -118,8 +117,7 @@ public Builder setRequestMethod(RequestMethod requestMethod) { */ @Deprecated public Builder requestUrl(String requestUrl) { - this.requestUrl = requestUrl; - return this; + return setRequestUrl(requestUrl); } /** @@ -138,8 +136,7 @@ public Builder setRequestUrl(String requestUrl) { */ @Deprecated public Builder requestSize(long requestSize) { - this.requestSize = requestSize; - return this; + return setRequestSize(requestSize); } /** @@ -156,8 +153,7 @@ public Builder setRequestSize(long requestSize) { */ @Deprecated public Builder status(int status) { - this.status = status; - return this; + return setStatus(status); } /** @@ -174,8 +170,7 @@ public Builder setStatus(int status) { */ @Deprecated public Builder responseSize(long responseSize) { - this.responseSize = responseSize; - return this; + return setResponseSize(responseSize); } /** @@ -193,8 +188,7 @@ public Builder setResponseSize(long responseSize) { */ @Deprecated public Builder userAgent(String userAgent) { - this.userAgent = userAgent; - return this; + return setUserAgent(userAgent); } /** @@ -212,8 +206,7 @@ public Builder setUserAgent(String userAgent) { */ @Deprecated public Builder remoteIp(String remoteIp) { - this.remoteIp = remoteIp; - return this; + return setRemoteIp(remoteIp); } /** @@ -231,8 +224,7 @@ public Builder setRemoteIp(String remoteIp) { */ @Deprecated public Builder serverIp(String serverIp) { - this.serverIp = serverIp; - return this; + return setServerIp(serverIp); } /** @@ -252,8 +244,7 @@ public Builder setServerIp(String serverIp) { */ @Deprecated public Builder referer(String referer) { - this.referer = referer; - return this; + return setReferer(referer); } /** @@ -272,8 +263,7 @@ public Builder setReferer(String referer) { */ @Deprecated public Builder cacheLookup(boolean cacheLookup) { - this.cacheLookup = cacheLookup; - return this; + return setCacheLookup(cacheLookup); } /** @@ -290,8 +280,7 @@ public Builder setCacheLookup(boolean cacheLookup) { */ @Deprecated public Builder cacheHit(boolean cacheHit) { - this.cacheHit = cacheHit; - return this; + return setCacheHit(cacheHit); } /** @@ -310,8 +299,7 @@ public Builder setCacheHit(boolean cacheHit) { */ @Deprecated public Builder cacheValidatedWithOriginServer(boolean cacheValidatedWithOriginServer) { - this.cacheValidatedWithOriginServer = cacheValidatedWithOriginServer; - return this; + return setCacheValidatedWithOriginServer(cacheValidatedWithOriginServer); } /** @@ -330,8 +318,7 @@ public Builder setCacheValidatedWithOriginServer(boolean cacheValidatedWithOrigi */ @Deprecated public Builder cacheFillBytes(long cacheFillBytes) { - this.cacheFillBytes = cacheFillBytes; - return this; + return setCacheFillBytes(cacheFillBytes); } /** @@ -372,7 +359,7 @@ public HttpRequest build() { */ @Deprecated public RequestMethod requestMethod() { - return requestMethod; + return getRequestMethod(); } /** @@ -389,7 +376,7 @@ public RequestMethod getRequestMethod() { */ @Deprecated public String requestUrl() { - return requestUrl; + return getRequestUrl(); } /** @@ -407,7 +394,7 @@ public String getRequestUrl() { */ @Deprecated public Long requestSize() { - return requestSize; + return getRequestSize(); } /** @@ -423,7 +410,7 @@ public Long getRequestSize() { */ @Deprecated public Integer status() { - return status; + return getStatus(); } /** @@ -439,7 +426,7 @@ public Integer getStatus() { */ @Deprecated public Long responseSize() { - return responseSize; + return getResponseSize(); } /** @@ -456,7 +443,7 @@ public Long getResponseSize() { */ @Deprecated public String userAgent() { - return userAgent; + return getUserAgent(); } /** @@ -473,7 +460,7 @@ public String getUserAgent() { */ @Deprecated public String remoteIp() { - return remoteIp; + return getRemoteIp(); } /** @@ -490,7 +477,7 @@ public String getRemoteIp() { */ @Deprecated public String serverIp() { - return serverIp; + return getServerIp(); } /** @@ -509,7 +496,7 @@ public String getServerIp() { */ @Deprecated public String referer() { - return referer; + return getReferer(); } /** @@ -553,7 +540,7 @@ public boolean cacheValidatedWithOriginServer() { */ @Deprecated public Long cacheFillBytes() { - return cacheFillBytes; + return getCacheFillBytes(); } /** @@ -665,7 +652,7 @@ com.google.logging.type.HttpRequest toPb() { */ @Deprecated public static Builder builder() { - return new Builder(); + return newBuilder(); } /** diff --git a/google-cloud-logging/src/main/java/com/google/cloud/logging/LogEntry.java b/google-cloud-logging/src/main/java/com/google/cloud/logging/LogEntry.java index 6d8dcab75e31..821c6e9b76af 100644 --- a/google-cloud-logging/src/main/java/com/google/cloud/logging/LogEntry.java +++ b/google-cloud-logging/src/main/java/com/google/cloud/logging/LogEntry.java @@ -104,8 +104,7 @@ public static class Builder { */ @Deprecated public Builder logName(String logName) { - this.logName = logName; - return this; + return setLogName(logName); } /** @@ -127,8 +126,7 @@ public Builder setLogName(String logName) { */ @Deprecated public Builder resource(MonitoredResource resource) { - this.resource = resource; - return this; + return setResource(resource); } /** @@ -147,8 +145,7 @@ public Builder setResource(MonitoredResource resource) { */ @Deprecated public Builder timestamp(long timestamp) { - this.timestamp = timestamp; - return this; + return setTimestamp(timestamp); } /** @@ -165,8 +162,7 @@ public Builder setTimestamp(long timestamp) { */ @Deprecated public Builder severity(Severity severity) { - this.severity = severity; - return this; + return setSeverity(severity); } /** @@ -184,8 +180,7 @@ public Builder setSeverity(Severity severity) { */ @Deprecated public Builder insertId(String insertId) { - this.insertId = insertId; - return this; + return setInsertId(insertId); } /** @@ -203,8 +198,7 @@ public Builder setInsertId(String insertId) { */ @Deprecated public Builder httpRequest(HttpRequest httpRequest) { - this.httpRequest = httpRequest; - return this; + return setHttpRequest(httpRequest); } /** @@ -221,8 +215,7 @@ public Builder setHttpRequest(HttpRequest httpRequest) { */ @Deprecated public Builder labels(Map labels) { - this.labels = new HashMap<>(checkNotNull(labels)); - return this; + return setLabels(labels); } /** @@ -257,8 +250,7 @@ public Builder clearLabels() { */ @Deprecated public Builder operation(Operation operation) { - this.operation = operation; - return this; + return setOperation(operation); } /** @@ -278,8 +270,7 @@ public Builder setOperation(Operation operation) { */ @Deprecated public Builder payload(Payload payload) { - this.payload = payload; - return this; + return setPayload(payload); } /** @@ -323,7 +314,7 @@ public LogEntry build() { */ @Deprecated public String logName() { - return logName; + return getLogName(); } /** @@ -344,7 +335,7 @@ public String getLogName() { */ @Deprecated public MonitoredResource resource() { - return resource; + return getResource(); } /** @@ -362,7 +353,7 @@ public MonitoredResource getResource() { */ @Deprecated public Long timestamp() { - return timestamp; + return getTimestamp(); } /** @@ -378,7 +369,7 @@ public Long getTimestamp() { */ @Deprecated public Severity severity() { - return severity; + return getSeverity(); } /** @@ -394,7 +385,7 @@ public Severity getSeverity() { */ @Deprecated public String insertId() { - return insertId; + return getInsertId(); } /** @@ -410,7 +401,7 @@ public String getInsertId() { */ @Deprecated public HttpRequest httpRequest() { - return httpRequest; + return getHttpRequest(); } /** @@ -426,7 +417,7 @@ public HttpRequest getHttpRequest() { */ @Deprecated public Map labels() { - return labels; + return getLabels(); } /** @@ -442,7 +433,7 @@ public Map getLabels() { */ @Deprecated public Operation operation() { - return operation; + return getOperation(); } /** @@ -462,7 +453,7 @@ public Operation getOperation() { @SuppressWarnings("unchecked") @Deprecated public T payload() { - return (T) payload; + return getPayload(); } /** @@ -560,7 +551,7 @@ com.google.logging.v2.LogEntry toPb(String projectId) { */ @Deprecated public static Builder builder(Payload payload) { - return new Builder(payload); + return newBuilder(payload); } /** diff --git a/google-cloud-logging/src/main/java/com/google/cloud/logging/LoggingLevel.java b/google-cloud-logging/src/main/java/com/google/cloud/logging/LoggingLevel.java index 2c0a24c9673f..53056993a6d2 100644 --- a/google-cloud-logging/src/main/java/com/google/cloud/logging/LoggingLevel.java +++ b/google-cloud-logging/src/main/java/com/google/cloud/logging/LoggingLevel.java @@ -91,7 +91,7 @@ private LoggingLevel(String name, int value, Severity severity) { */ @Deprecated public Severity severity() { - return severity; + return getSeverity(); } /** diff --git a/google-cloud-logging/src/main/java/com/google/cloud/logging/Metric.java b/google-cloud-logging/src/main/java/com/google/cloud/logging/Metric.java index b5a8c85c3976..3be29ef1cd0d 100644 --- a/google-cloud-logging/src/main/java/com/google/cloud/logging/Metric.java +++ b/google-cloud-logging/src/main/java/com/google/cloud/logging/Metric.java @@ -60,8 +60,7 @@ private Builder(Metric metric) { @Override @Deprecated public Builder name(String name) { - delegate.setName(name); - return this; + return setName(name); } @Override @@ -73,8 +72,7 @@ public Builder setName(String name) { @Override @Deprecated public Builder description(String description) { - delegate.setDescription(description); - return this; + return setDescription(description); } @Override @@ -86,8 +84,7 @@ public Builder setDescription(String description) { @Override @Deprecated public Builder filter(String filter) { - delegate.setFilter(filter); - return this; + return setFilter(filter); } @Override @@ -135,7 +132,7 @@ public final boolean equals(Object obj) { */ @Deprecated public Logging logging() { - return logging; + return getLogging(); } /** diff --git a/google-cloud-logging/src/main/java/com/google/cloud/logging/MetricInfo.java b/google-cloud-logging/src/main/java/com/google/cloud/logging/MetricInfo.java index 5813633f692e..9be96f8d2ce8 100644 --- a/google-cloud-logging/src/main/java/com/google/cloud/logging/MetricInfo.java +++ b/google-cloud-logging/src/main/java/com/google/cloud/logging/MetricInfo.java @@ -119,8 +119,7 @@ static final class BuilderImpl extends Builder { @Override @Deprecated public Builder name(String name) { - this.name = name; - return this; + return setName(name); } @Override @@ -132,8 +131,7 @@ public Builder setName(String name) { @Override @Deprecated public Builder description(String description) { - this.description = description; - return this; + return setDescription(description); } @Override @@ -145,8 +143,7 @@ public Builder setDescription(String description) { @Override @Deprecated public Builder filter(String filter) { - this.filter = filter; - return this; + return setFilter(filter); } @Override @@ -176,7 +173,7 @@ public MetricInfo build() { */ @Deprecated public String name() { - return name; + return getName(); } /** @@ -195,7 +192,7 @@ public String getName() { */ @Deprecated public String description() { - return description; + return getDescription(); } /** @@ -215,7 +212,7 @@ public String getDescription() { */ @Deprecated public String filter() { - return filter; + return getFilter(); } /** @@ -273,7 +270,7 @@ public Builder toBuilder() { */ @Deprecated public static Builder builder(String name, String filter) { - return new BuilderImpl(name, filter); + return newBuilder(name, filter); } /** diff --git a/google-cloud-logging/src/main/java/com/google/cloud/logging/Operation.java b/google-cloud-logging/src/main/java/com/google/cloud/logging/Operation.java index 33a0f804b8b2..468f40feb733 100644 --- a/google-cloud-logging/src/main/java/com/google/cloud/logging/Operation.java +++ b/google-cloud-logging/src/main/java/com/google/cloud/logging/Operation.java @@ -69,8 +69,7 @@ public static final class Builder { */ @Deprecated public Builder id(String id) { - this.id = id; - return this; + return setId(id); } /** @@ -89,8 +88,7 @@ public Builder setId(String id) { */ @Deprecated public Builder producer(String producer) { - this.producer = producer; - return this; + return setProducer(producer); } /** @@ -109,8 +107,7 @@ public Builder setProducer(String producer) { */ @Deprecated public Builder first(boolean first) { - this.first = first; - return this; + return setFirst(first); } /** @@ -128,8 +125,7 @@ public Builder setFirst(boolean first) { */ @Deprecated public Builder last(boolean last) { - this.last = last; - return this; + return setLast(last); } /** @@ -163,7 +159,7 @@ public Operation build() { */ @Deprecated public String id() { - return id; + return getId(); } /** @@ -182,7 +178,7 @@ public String getId() { */ @Deprecated public String producer() { - return producer; + return getProducer(); } /** @@ -262,7 +258,7 @@ LogEntryOperation toPb() { */ @Deprecated public static Builder builder(String id, String producer) { - return new Builder(id, producer); + return newBuilder(id, producer); } /** diff --git a/google-cloud-logging/src/main/java/com/google/cloud/logging/Payload.java b/google-cloud-logging/src/main/java/com/google/cloud/logging/Payload.java index 0884629968de..c7b6a8a20f43 100644 --- a/google-cloud-logging/src/main/java/com/google/cloud/logging/Payload.java +++ b/google-cloud-logging/src/main/java/com/google/cloud/logging/Payload.java @@ -102,7 +102,7 @@ public static final class JsonPayload extends Payload { */ @Deprecated public Map dataAsMap() { - return Structs.asMap(getData()); + return getDataAsMap(); } /** @@ -194,7 +194,7 @@ private Payload(Type type, T data) { */ @Deprecated public Type type() { - return type; + return getType(); } /** @@ -210,7 +210,7 @@ public Type getType() { */ @Deprecated public T data() { - return data; + return getData(); } /** diff --git a/google-cloud-logging/src/main/java/com/google/cloud/logging/Sink.java b/google-cloud-logging/src/main/java/com/google/cloud/logging/Sink.java index 4451dc4e8e88..5ebac1896896 100644 --- a/google-cloud-logging/src/main/java/com/google/cloud/logging/Sink.java +++ b/google-cloud-logging/src/main/java/com/google/cloud/logging/Sink.java @@ -66,8 +66,7 @@ private Builder(Sink sink) { @Override @Deprecated public Builder name(String name) { - delegate.setName(name); - return this; + return setName(name); } @Override @@ -79,8 +78,7 @@ public Builder setName(String name) { @Override @Deprecated public Builder destination(Destination destination) { - delegate.setDestination(destination); - return this; + return setDestination(destination); } @Override @@ -92,8 +90,7 @@ public Builder setDestination(Destination destination) { @Override @Deprecated public Builder filter(String filter) { - delegate.setFilter(filter); - return this; + return setFilter(filter); } @Override @@ -105,8 +102,7 @@ public Builder setFilter(String filter) { @Override @Deprecated public Builder versionFormat(VersionFormat versionFormat) { - delegate.setVersionFormat(versionFormat); - return this; + return setVersionFormat(versionFormat); } @Override @@ -154,7 +150,7 @@ public final boolean equals(Object obj) { */ @Deprecated public Logging logging() { - return logging; + return getLogging(); } /** diff --git a/google-cloud-logging/src/main/java/com/google/cloud/logging/SinkInfo.java b/google-cloud-logging/src/main/java/com/google/cloud/logging/SinkInfo.java index 63b603dcec04..af218c2b3a11 100644 --- a/google-cloud-logging/src/main/java/com/google/cloud/logging/SinkInfo.java +++ b/google-cloud-logging/src/main/java/com/google/cloud/logging/SinkInfo.java @@ -97,7 +97,7 @@ public static final class BucketDestination extends Destination { */ @Deprecated public String bucket() { - return bucket; + return getBucket(); } /** @@ -181,7 +181,7 @@ public static final class DatasetDestination extends Destination { */ @Deprecated public String project() { - return project; + return getProject(); } /** @@ -197,7 +197,7 @@ public String getProject() { */ @Deprecated public String dataset() { - return dataset; + return getDataset(); } /** @@ -294,7 +294,7 @@ public static final class TopicDestination extends Destination { */ @Deprecated public String project() { - return project; + return getProject(); } /** @@ -310,7 +310,7 @@ public String getProject() { */ @Deprecated public String topic() { - return topic; + return getTopic(); } /** @@ -391,7 +391,7 @@ static TopicDestination fromPb(String destinationPb) { */ @Deprecated public Type type() { - return type; + return getType(); } /** @@ -569,8 +569,7 @@ static final class BuilderImpl extends Builder { @Override @Deprecated public Builder name(String name) { - this.name = name; - return this; + return setName(name); } @Override @@ -582,8 +581,7 @@ public Builder setName(String name) { @Override @Deprecated public Builder destination(Destination destination) { - this.destination = destination; - return this; + return setDestination(destination); } @Override @@ -595,8 +593,7 @@ public Builder setDestination(Destination destination) { @Override @Deprecated public Builder filter(String filter) { - this.filter = filter; - return this; + return setFilter(filter); } @Override @@ -608,8 +605,7 @@ public Builder setFilter(String filter) { @Override @Deprecated public Builder versionFormat(VersionFormat versionFormat) { - this.versionFormat = versionFormat; - return this; + return setVersionFormat(versionFormat); } @Override @@ -638,7 +634,7 @@ public SinkInfo build() { */ @Deprecated public String name() { - return name; + return getName(); } /** @@ -663,7 +659,7 @@ public String getName() { @SuppressWarnings("unchecked") @Deprecated public T destination() { - return (T) destination; + return getDestination(); } /** @@ -692,7 +688,7 @@ public T getDestination() { */ @Deprecated public String filter() { - return filter; + return getFilter(); } /** @@ -715,7 +711,7 @@ public String getFilter() { */ @Deprecated public VersionFormat versionFormat() { - return versionFormat; + return getVersionFormat(); } /** @@ -772,7 +768,7 @@ public Builder toBuilder() { */ @Deprecated public static Builder builder(String name, Destination destination) { - return new BuilderImpl(name, destination); + return newBuilder(name, destination); } /** diff --git a/google-cloud-logging/src/main/java/com/google/cloud/logging/testing/RemoteLoggingHelper.java b/google-cloud-logging/src/main/java/com/google/cloud/logging/testing/RemoteLoggingHelper.java index 2d19e7cc03fa..65bb9bfaa0d7 100644 --- a/google-cloud-logging/src/main/java/com/google/cloud/logging/testing/RemoteLoggingHelper.java +++ b/google-cloud-logging/src/main/java/com/google/cloud/logging/testing/RemoteLoggingHelper.java @@ -49,7 +49,7 @@ private RemoteLoggingHelper(LoggingOptions options) { */ @Deprecated public LoggingOptions options() { - return options; + return getOptions(); } /**