software.amazon.kinesis.metrics.MetricDatumWithKey Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of amazon-kinesis-client Show documentation
Show all versions of amazon-kinesis-client Show documentation
The Amazon Kinesis Client Library for Java enables Java developers to easily consume and process data
from Amazon Kinesis.
/*
* Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Amazon Software License (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/asl/
*
* 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.kinesis.metrics;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Setter;
import lombok.experimental.Accessors;
import software.amazon.awssdk.services.cloudwatch.model.MetricDatum;
import java.util.Objects;
/**
* This class is used to store a MetricDatum as well as KeyType which stores specific information about
* that particular MetricDatum.
*
* @param is a class that stores information about a MetricDatum. This is useful
* to compare MetricDatums, aggregate similar MetricDatums or store information about a datum
* that may be relevant to the user (i.e. MetricName, CustomerId, TimeStamp, etc).
*
* Example:
*
* Let SampleMetricKey be a KeyType that takes in the time in which the datum was created.
*
* MetricDatumWithKey sampleDatumWithKey = new MetricDatumWithKey(new
* SampleMetricKey(System.currentTimeMillis()), datum)
*
*/
@AllArgsConstructor
@Setter
@Accessors(fluent = true)
public class MetricDatumWithKey {
/**
* An object that stores relevant information about a MetricDatum (e.g. MetricName, accountId, TimeStamp)
*/
public KeyType key;
/**
* Data point
*/
public MetricDatum datum;
@Override
public int hashCode() {
return Objects.hash(key, datum);
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
MetricDatumWithKey> other = (MetricDatumWithKey>) obj;
return Objects.equals(other.key, key) && Objects.equals(other.datum, datum);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy