
software.amazon.awssdk.services.iotanalytics.model.DeltaTime Maven / Gradle / Ivy
/*
* 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.iotanalytics.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;
/**
*
* Used to limit data to that which has arrived since the last execution of the action.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class DeltaTime implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField OFFSET_SECONDS_FIELD = SdkField. builder(MarshallingType.INTEGER)
.getter(getter(DeltaTime::offsetSeconds)).setter(setter(Builder::offsetSeconds))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("offsetSeconds").build()).build();
private static final SdkField TIME_EXPRESSION_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(DeltaTime::timeExpression)).setter(setter(Builder::timeExpression))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("timeExpression").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(OFFSET_SECONDS_FIELD,
TIME_EXPRESSION_FIELD));
private static final long serialVersionUID = 1L;
private final Integer offsetSeconds;
private final String timeExpression;
private DeltaTime(BuilderImpl builder) {
this.offsetSeconds = builder.offsetSeconds;
this.timeExpression = builder.timeExpression;
}
/**
*
* The number of seconds of estimated "in flight" lag time of message data. When you create data set contents using
* message data from a specified time frame, some message data may still be "in flight" when processing begins, and
* so will not arrive in time to be processed. Use this field to make allowances for the "in flight" time of your
* message data, so that data not processed from a previous time frame will be included with the next time frame.
* Without this, missed message data would be excluded from processing during the next time frame as well, because
* its timestamp places it within the previous time frame.
*
*
* @return The number of seconds of estimated "in flight" lag time of message data. When you create data set
* contents using message data from a specified time frame, some message data may still be "in flight" when
* processing begins, and so will not arrive in time to be processed. Use this field to make allowances for
* the "in flight" time of your message data, so that data not processed from a previous time frame will be
* included with the next time frame. Without this, missed message data would be excluded from processing
* during the next time frame as well, because its timestamp places it within the previous time frame.
*/
public Integer offsetSeconds() {
return offsetSeconds;
}
/**
*
* An expression by which the time of the message data may be determined. This may be the name of a timestamp field,
* or a SQL expression which is used to derive the time the message data was generated.
*
*
* @return An expression by which the time of the message data may be determined. This may be the name of a
* timestamp field, or a SQL expression which is used to derive the time the message data was generated.
*/
public String timeExpression() {
return timeExpression;
}
@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(offsetSeconds());
hashCode = 31 * hashCode + Objects.hashCode(timeExpression());
return hashCode;
}
@Override
public boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof DeltaTime)) {
return false;
}
DeltaTime other = (DeltaTime) obj;
return Objects.equals(offsetSeconds(), other.offsetSeconds()) && Objects.equals(timeExpression(), other.timeExpression());
}
/**
* 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 String toString() {
return ToString.builder("DeltaTime").add("OffsetSeconds", offsetSeconds()).add("TimeExpression", timeExpression())
.build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "offsetSeconds":
return Optional.ofNullable(clazz.cast(offsetSeconds()));
case "timeExpression":
return Optional.ofNullable(clazz.cast(timeExpression()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function