
software.amazon.awssdk.services.cloudwatch.model.StatisticSet Maven / Gradle / Ivy
Go to download
A single bundled dependency that includes all service and dependent JARs with third-party libraries
relocated to different namespaces.
/*
* Copyright 2013-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package software.amazon.awssdk.services.cloudwatch.model;
import java.util.Objects;
import java.util.Optional;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Represents a set of statistics that describes a specific metric.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class StatisticSet implements ToCopyableBuilder {
private final Double sampleCount;
private final Double sum;
private final Double minimum;
private final Double maximum;
private StatisticSet(BuilderImpl builder) {
this.sampleCount = builder.sampleCount;
this.sum = builder.sum;
this.minimum = builder.minimum;
this.maximum = builder.maximum;
}
/**
*
* The number of samples used for the statistic set.
*
*
* @return The number of samples used for the statistic set.
*/
public Double sampleCount() {
return sampleCount;
}
/**
*
* The sum of values for the sample set.
*
*
* @return The sum of values for the sample set.
*/
public Double sum() {
return sum;
}
/**
*
* The minimum value of the sample set.
*
*
* @return The minimum value of the sample set.
*/
public Double minimum() {
return minimum;
}
/**
*
* The maximum value of the sample set.
*
*
* @return The maximum value of the sample set.
*/
public Double maximum() {
return maximum;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(sampleCount());
hashCode = 31 * hashCode + Objects.hashCode(sum());
hashCode = 31 * hashCode + Objects.hashCode(minimum());
hashCode = 31 * hashCode + Objects.hashCode(maximum());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof StatisticSet)) {
return false;
}
StatisticSet other = (StatisticSet) obj;
return Objects.equals(sampleCount(), other.sampleCount()) && Objects.equals(sum(), other.sum())
&& Objects.equals(minimum(), other.minimum()) && Objects.equals(maximum(), other.maximum());
}
@Override
public String toString() {
return ToString.builder("StatisticSet").add("SampleCount", sampleCount()).add("Sum", sum()).add("Minimum", minimum())
.add("Maximum", maximum()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "SampleCount":
return Optional.ofNullable(clazz.cast(sampleCount()));
case "Sum":
return Optional.ofNullable(clazz.cast(sum()));
case "Minimum":
return Optional.ofNullable(clazz.cast(minimum()));
case "Maximum":
return Optional.ofNullable(clazz.cast(maximum()));
default:
return Optional.empty();
}
}
public interface Builder extends CopyableBuilder {
/**
*
* The number of samples used for the statistic set.
*
*
* @param sampleCount
* The number of samples used for the statistic set.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder sampleCount(Double sampleCount);
/**
*
* The sum of values for the sample set.
*
*
* @param sum
* The sum of values for the sample set.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder sum(Double sum);
/**
*
* The minimum value of the sample set.
*
*
* @param minimum
* The minimum value of the sample set.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder minimum(Double minimum);
/**
*
* The maximum value of the sample set.
*
*
* @param maximum
* The maximum value of the sample set.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder maximum(Double maximum);
}
static final class BuilderImpl implements Builder {
private Double sampleCount;
private Double sum;
private Double minimum;
private Double maximum;
private BuilderImpl() {
}
private BuilderImpl(StatisticSet model) {
sampleCount(model.sampleCount);
sum(model.sum);
minimum(model.minimum);
maximum(model.maximum);
}
public final Double getSampleCount() {
return sampleCount;
}
@Override
public final Builder sampleCount(Double sampleCount) {
this.sampleCount = sampleCount;
return this;
}
public final void setSampleCount(Double sampleCount) {
this.sampleCount = sampleCount;
}
public final Double getSum() {
return sum;
}
@Override
public final Builder sum(Double sum) {
this.sum = sum;
return this;
}
public final void setSum(Double sum) {
this.sum = sum;
}
public final Double getMinimum() {
return minimum;
}
@Override
public final Builder minimum(Double minimum) {
this.minimum = minimum;
return this;
}
public final void setMinimum(Double minimum) {
this.minimum = minimum;
}
public final Double getMaximum() {
return maximum;
}
@Override
public final Builder maximum(Double maximum) {
this.maximum = maximum;
return this;
}
public final void setMaximum(Double maximum) {
this.maximum = maximum;
}
@Override
public StatisticSet build() {
return new StatisticSet(this);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy