software.amazon.awssdk.services.cloudwatch.model.StatisticSet Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cloudwatch Show documentation
Show all versions of cloudwatch Show documentation
The AWS Java SDK for Amazon CloudWatch module holds the client classes that are used for communicating
with Amazon CloudWatch Service
/*
* Copyright 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.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.LocationTrait;
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 SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField SAMPLE_COUNT_FIELD = SdkField. builder(MarshallingType.DOUBLE)
.memberName("SampleCount").getter(getter(StatisticSet::sampleCount)).setter(setter(Builder::sampleCount))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SampleCount").build()).build();
private static final SdkField SUM_FIELD = SdkField. builder(MarshallingType.DOUBLE).memberName("Sum")
.getter(getter(StatisticSet::sum)).setter(setter(Builder::sum))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Sum").build()).build();
private static final SdkField MINIMUM_FIELD = SdkField. builder(MarshallingType.DOUBLE).memberName("Minimum")
.getter(getter(StatisticSet::minimum)).setter(setter(Builder::minimum))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Minimum").build()).build();
private static final SdkField MAXIMUM_FIELD = SdkField. builder(MarshallingType.DOUBLE).memberName("Maximum")
.getter(getter(StatisticSet::maximum)).setter(setter(Builder::maximum))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Maximum").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(SAMPLE_COUNT_FIELD, SUM_FIELD,
MINIMUM_FIELD, MAXIMUM_FIELD));
private static final long serialVersionUID = 1L;
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 final Double sampleCount() {
return sampleCount;
}
/**
*
* The sum of values for the sample set.
*
*
* @return The sum of values for the sample set.
*/
public final Double sum() {
return sum;
}
/**
*
* The minimum value of the sample set.
*
*
* @return The minimum value of the sample set.
*/
public final Double minimum() {
return minimum;
}
/**
*
* The maximum value of the sample set.
*
*
* @return The maximum value of the sample set.
*/
public final 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 final 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 final boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(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());
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*/
@Override
public final String toString() {
return ToString.builder("StatisticSet").add("SampleCount", sampleCount()).add("Sum", sum()).add("Minimum", minimum())
.add("Maximum", maximum()).build();
}
public final 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();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function
© 2015 - 2025 Weber Informatics LLC | Privacy Policy