mirror of https://github.com/apache/jclouds.git
Follow up to e58d91e
that addresses pull request comments.
This commit is contained in:
parent
270dfcbff2
commit
f06d273764
|
@ -18,10 +18,11 @@
|
|||
*/
|
||||
package org.jclouds.cloudwatch.domain;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @see <a href="http://docs.amazonwebservices.com/AmazonCloudWatch/latest/DeveloperGuide/index.html?DT_Datapoint.html"
|
||||
* />
|
||||
|
@ -118,17 +119,7 @@ public class Datapoint {
|
|||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((average == null) ? 0 : average.hashCode());
|
||||
result = prime * result + ((customUnit == null) ? 0 : customUnit.hashCode());
|
||||
result = prime * result + ((maximum == null) ? 0 : maximum.hashCode());
|
||||
result = prime * result + ((minimum == null) ? 0 : minimum.hashCode());
|
||||
result = prime * result + ((samples == null) ? 0 : samples.hashCode());
|
||||
result = prime * result + ((sum == null) ? 0 : sum.hashCode());
|
||||
result = prime * result + ((timestamp == null) ? 0 : timestamp.hashCode());
|
||||
result = prime * result + ((unit == null) ? 0 : unit.hashCode());
|
||||
return result;
|
||||
return Objects.hashCode(super.hashCode(), average, customUnit, maximum, minimum, samples, sum, timestamp, unit);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -140,53 +131,27 @@ public class Datapoint {
|
|||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Datapoint other = (Datapoint) obj;
|
||||
if (average == null) {
|
||||
if (other.average != null)
|
||||
return false;
|
||||
} else if (!average.equals(other.average))
|
||||
return false;
|
||||
if (customUnit == null) {
|
||||
if (other.customUnit != null)
|
||||
return false;
|
||||
} else if (!customUnit.equals(other.customUnit))
|
||||
return false;
|
||||
if (maximum == null) {
|
||||
if (other.maximum != null)
|
||||
return false;
|
||||
} else if (!maximum.equals(other.maximum))
|
||||
return false;
|
||||
if (minimum == null) {
|
||||
if (other.minimum != null)
|
||||
return false;
|
||||
} else if (!minimum.equals(other.minimum))
|
||||
return false;
|
||||
if (samples == null) {
|
||||
if (other.samples != null)
|
||||
return false;
|
||||
} else if (!samples.equals(other.samples))
|
||||
return false;
|
||||
if (sum == null) {
|
||||
if (other.sum != null)
|
||||
return false;
|
||||
} else if (!sum.equals(other.sum))
|
||||
return false;
|
||||
if (timestamp == null) {
|
||||
if (other.timestamp != null)
|
||||
return false;
|
||||
} else if (!timestamp.equals(other.timestamp))
|
||||
return false;
|
||||
if (unit == null) {
|
||||
if (other.unit != null)
|
||||
return false;
|
||||
} else if (!unit.equals(other.unit))
|
||||
return false;
|
||||
return true;
|
||||
return Objects.equal(this.average, other.average) &&
|
||||
Objects.equal(this.customUnit, other.maximum) &&
|
||||
Objects.equal(this.maximum, other.maximum) &&
|
||||
Objects.equal(this.minimum, other.minimum) &&
|
||||
Objects.equal(this.samples, other.samples) &&
|
||||
Objects.equal(this.sum, other.sum) &&
|
||||
Objects.equal(this.timestamp, other.timestamp) &&
|
||||
Objects.equal(this.unit, other.unit);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[average=" + average + ", customUnit=" + customUnit + ", maximum=" + maximum + ", minimum=" + minimum
|
||||
+ ", samples=" + samples + ", sum=" + sum + ", timestamp=" + timestamp + ", unit=" + unit + "]";
|
||||
return Objects.toStringHelper(this)
|
||||
.add("timestamp", timestamp)
|
||||
.add("customUnit", customUnit)
|
||||
.add("maximum", maximum)
|
||||
.add("minimum", minimum)
|
||||
.add("average", average)
|
||||
.add("sum", sum)
|
||||
.add("samples", samples)
|
||||
.add("unit", unit).toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
*/
|
||||
package org.jclouds.cloudwatch.domain;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
/**
|
||||
* @see <a href="http://docs.amazonwebservices.com/AmazonCloudWatch/latest/APIReference/API_Dimension.html" />
|
||||
*
|
||||
|
@ -47,6 +49,14 @@ public class Dimension {
|
|||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(super.hashCode(), name, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
@ -59,17 +69,8 @@ public class Dimension {
|
|||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Dimension other = (Dimension)obj;
|
||||
if (name == null) {
|
||||
if (other.name != null)
|
||||
return false;
|
||||
} else if (!name.equals(other.name))
|
||||
return false;
|
||||
if (value == null) {
|
||||
if (other.value != null)
|
||||
return false;
|
||||
} else if (!value.equals(other.value))
|
||||
return false;
|
||||
return true;
|
||||
return Objects.equal(this.name, other.name) &&
|
||||
Objects.equal(this.value, other.value);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -77,7 +78,9 @@ public class Dimension {
|
|||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[name=" + name + ", value=" + value + "]";
|
||||
return Objects.toStringHelper(this)
|
||||
.add("name", name)
|
||||
.add("value", value).toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,10 +18,10 @@
|
|||
*/
|
||||
package org.jclouds.cloudwatch.domain;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.collect.Sets;
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
|
@ -61,6 +61,14 @@ public class GetMetricStatisticsResponse {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(super.hashCode(), datapoints, label);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
|
@ -69,17 +77,8 @@ public class GetMetricStatisticsResponse {
|
|||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
GetMetricStatisticsResponse other = (GetMetricStatisticsResponse)obj;
|
||||
if (datapoints == null) {
|
||||
if (other.datapoints != null)
|
||||
return false;
|
||||
} else if (!datapoints.equals(other.datapoints))
|
||||
return false;
|
||||
if (label == null) {
|
||||
if (other.label != null)
|
||||
return false;
|
||||
} else if (!label.equals(other.label))
|
||||
return false;
|
||||
return true;
|
||||
return Objects.equal(this.datapoints, other.datapoints) &&
|
||||
Objects.equal(this.label, other.label);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -87,25 +86,9 @@ public class GetMetricStatisticsResponse {
|
|||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
builder.append("[label=")
|
||||
.append(label)
|
||||
.append(", datapoints=[");
|
||||
|
||||
Iterator<Datapoint> iterator = datapoints.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
builder.append(iterator.next());
|
||||
|
||||
if (iterator.hasNext()) {
|
||||
builder.append(", ");
|
||||
}
|
||||
}
|
||||
|
||||
builder.append("]]");
|
||||
|
||||
return builder.toString();
|
||||
return Objects.toStringHelper(this)
|
||||
.add("label", label)
|
||||
.add("datapoints", datapoints).toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,10 +18,10 @@
|
|||
*/
|
||||
package org.jclouds.cloudwatch.domain;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.collect.Sets;
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
|
@ -63,6 +63,14 @@ public class ListMetricsResponse {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(super.hashCode(), metrics, nextToken);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
|
@ -71,17 +79,8 @@ public class ListMetricsResponse {
|
|||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
ListMetricsResponse other = (ListMetricsResponse)obj;
|
||||
if (metrics == null) {
|
||||
if (other.metrics != null)
|
||||
return false;
|
||||
} else if (!metrics.equals(other.metrics))
|
||||
return false;
|
||||
if (nextToken == null) {
|
||||
if (other.nextToken != null)
|
||||
return false;
|
||||
} else if (!nextToken.equals(other.nextToken))
|
||||
return false;
|
||||
return true;
|
||||
return Objects.equal(this.metrics, other.metrics) &&
|
||||
Objects.equal(this.nextToken, other.nextToken);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -89,27 +88,9 @@ public class ListMetricsResponse {
|
|||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
builder.append("[metrics=[");
|
||||
|
||||
Iterator<Metric> iterator = metrics.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
builder.append(iterator.next());
|
||||
|
||||
if (iterator.hasNext()) {
|
||||
builder.append(", ");
|
||||
}
|
||||
}
|
||||
|
||||
builder.append("]");
|
||||
|
||||
builder.append(", nextToken=")
|
||||
.append(nextToken)
|
||||
.append("]");
|
||||
|
||||
return builder.toString();
|
||||
return Objects.toStringHelper(this)
|
||||
.add("metrics", metrics)
|
||||
.add("nextToken", nextToken).toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,10 +18,10 @@
|
|||
*/
|
||||
package org.jclouds.cloudwatch.domain;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.collect.Sets;
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
|
@ -73,30 +73,8 @@ public class Metric {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
builder.append("[metricName=")
|
||||
.append(metricName)
|
||||
.append(", namespace=")
|
||||
.append(namespace);
|
||||
|
||||
|
||||
builder.append(", dimensions=[");
|
||||
|
||||
Iterator<Dimension> iterator = dimensions.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
builder.append(iterator.next());
|
||||
|
||||
if (iterator.hasNext()) {
|
||||
builder.append(", ");
|
||||
}
|
||||
}
|
||||
|
||||
builder.append("]]");
|
||||
|
||||
return builder.toString();
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(super.hashCode(), dimensions, metricName, namespace);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -111,22 +89,20 @@ public class Metric {
|
|||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Metric other = (Metric)obj;
|
||||
if (metricName == null) {
|
||||
if (other.metricName != null)
|
||||
return false;
|
||||
} else if (!metricName.equals(other.metricName))
|
||||
return false;
|
||||
if (namespace == null) {
|
||||
if (other.namespace != null)
|
||||
return false;
|
||||
} else if (!namespace.equals(other.namespace))
|
||||
return false;
|
||||
if (dimensions == null) {
|
||||
if (other.dimensions != null)
|
||||
return false;
|
||||
} else if (!dimensions.equals(other.dimensions))
|
||||
return false;
|
||||
return true;
|
||||
return Objects.equal(this.dimensions, other.dimensions) &&
|
||||
Objects.equal(this.metricName, other.metricName) &&
|
||||
Objects.equal(this.namespace, other.namespace);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this)
|
||||
.add("namespace", namespace)
|
||||
.add("metricName", metricName)
|
||||
.add("dimension", dimensions).toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
package org.jclouds.cloudwatch.options;
|
||||
|
||||
import com.google.common.annotations.Beta;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.Sets;
|
||||
import org.jclouds.cloudwatch.domain.Dimension;
|
||||
|
@ -38,6 +39,7 @@ import java.util.Set;
|
|||
*
|
||||
* @author Jeremy Whitlock
|
||||
*/
|
||||
@Beta
|
||||
public class GetMetricStatisticsOptionsV2 extends BaseHttpRequestOptions {
|
||||
|
||||
private static final DateService dateService = new SimpleDateFormatDateService();
|
||||
|
|
Loading…
Reference in New Issue