public class Metric extends MetricInfo
MetricInfo.getFilter()
).
Metric
adds a layer of service-related functionality over MetricInfo
. Objects
of this class are immutable. To get a Metric
object with the most recent information use
reload()
or reloadAsync()
.
Modifier and Type | Class and Description |
---|---|
static class |
Metric.Builder
A builder for
Metric objects. |
Modifier and Type | Method and Description |
---|---|
boolean |
delete()
Deletes this metric.
|
com.google.api.core.ApiFuture<Boolean> |
deleteAsync()
Sends a request for deleting this metric.
|
boolean |
equals(Object obj) |
Logging |
getLogging()
Returns the metrics's
Logging object used to issue requests. |
int |
hashCode() |
Metric |
reload()
Fetches current metric's latest information.
|
com.google.api.core.ApiFuture<Metric> |
reloadAsync()
Sends a request to fetch current metric's latest information.
|
Metric.Builder |
toBuilder()
Returns a builder for this
MetricInfo object. |
Metric |
update()
Updates current metric.
|
com.google.api.core.ApiFuture<Metric> |
updateAsync()
Sends a request to update current metric.
|
getDescription, getFilter, getName, newBuilder, of, toString
public Metric.Builder toBuilder()
MetricInfo
MetricInfo
object.toBuilder
in class MetricInfo
public final int hashCode()
hashCode
in class MetricInfo
public final boolean equals(Object obj)
equals
in class MetricInfo
public Logging getLogging()
Logging
object used to issue requests.public boolean delete()
Example of deleting the metric.
boolean deleted = metric.delete();
if (deleted) {
// the metric was deleted
} else {
// the metric was not found
}
true
if the metric was deleted, false
if it was not foundLoggingException
- upon failurepublic com.google.api.core.ApiFuture<Boolean> deleteAsync()
ApiFuture
object to
consume the result. Future.get()
returns true
if the metric was deleted,
false
if it was not found.
Example of asynchronously deleting the metric.
ApiFuture<Boolean> future = metric.deleteAsync();
// ...
boolean deleted = future.get();
if (deleted) {
// the metric was deleted
} else {
// the metric was not found
}
LoggingException
- upon failurepublic Metric reload()
null
if the metric does not exist.
Example of getting the metric's latest information.
Metric latestMetric = metric.reload();
if (latestMetric == null) {
// the metric was not found
}
Metric
object with latest information or null
if not foundLoggingException
- upon failurepublic com.google.api.core.ApiFuture<Metric> reloadAsync()
ApiFuture
object to consume the result. Future.get()
returns a Metric
object with latest information or null
if not found.
Example of asynchronously getting the metric's latest information.
ApiFuture<Metric> future = metric.reloadAsync();
// ...
Metric latestMetric = future.get();
if (latestMetric == null) {
// the metric was not found
}
LoggingException
- upon failurepublic Metric update()
Example of updating the metric's information.
Metric updatedMetric = metric.toBuilder()
.setDescription("A more detailed description")
.build()
.update();
Metric
object with updated informationLoggingException
- upon failurepublic com.google.api.core.ApiFuture<Metric> updateAsync()
ApiFuture
object to consume the result. Future.get()
returns a Metric
object with updated information.
Example of asynchronously updating the metric's information.
ApiFuture<Metric> future = metric.toBuilder()
.setDescription("A more detailed description")
.build()
.updateAsync();
// ...
Metric updatedMetric = future.get();
LoggingException
- upon failureCopyright © 2019 Google LLC. All rights reserved.