All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.iottwinmaker.model.PropertyValue Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Io T Twin Maker module holds the client classes that are used for communicating with Io T Twin Maker.

There is a newer version: 2.29.20
Show newest version
/*
 * 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.iottwinmaker.model;

import java.io.Serializable;
import java.time.Instant;
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.Consumer;
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;

/**
 * 

* An object that contains information about a value for a time series property. *

*/ @Generated("software.amazon.awssdk:codegen") public final class PropertyValue implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField TIME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("time") .getter(getter(PropertyValue::time)).setter(setter(Builder::time)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("time").build()).build(); private static final SdkField TIMESTAMP_FIELD = SdkField. builder(MarshallingType.INSTANT) .memberName("timestamp").getter(getter(PropertyValue::timestamp)).setter(setter(Builder::timestamp)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("timestamp").build()).build(); private static final SdkField VALUE_FIELD = SdkField. builder(MarshallingType.SDK_POJO) .memberName("value").getter(getter(PropertyValue::value)).setter(setter(Builder::value)) .constructor(DataValue::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("value").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(TIME_FIELD, TIMESTAMP_FIELD, VALUE_FIELD)); private static final long serialVersionUID = 1L; private final String time; private final Instant timestamp; private final DataValue value; private PropertyValue(BuilderImpl builder) { this.time = builder.time; this.timestamp = builder.timestamp; this.value = builder.value; } /** *

* ISO8601 DateTime of a value for a time series property. *

*

* The time for when the property value was recorded in ISO 8601 format: * YYYY-MM-DDThh:mm:ss[.SSSSSSSSS][Z/±HH:mm]. *

*
    *
  • *

    * [YYYY]: year *

    *
  • *
  • *

    * [MM]: month *

    *
  • *
  • *

    * [DD]: day *

    *
  • *
  • *

    * [hh]: hour *

    *
  • *
  • *

    * [mm]: minute *

    *
  • *
  • *

    * [ss]: seconds *

    *
  • *
  • *

    * [.SSSSSSSSS]: additional precision, where precedence is maintained. For example: [.573123] is equal to * 573123000 nanoseconds. *

    *
  • *
  • *

    * Z: default timezone UTC *

    *
  • *
  • *

    * ± HH:mm: time zone offset in Hours and Minutes. *

    *
  • *
*

* Required sub-fields: YYYY-MM-DDThh:mm:ss and [Z/±HH:mm] *

* * @return ISO8601 DateTime of a value for a time series property.

*

* The time for when the property value was recorded in ISO 8601 format: * YYYY-MM-DDThh:mm:ss[.SSSSSSSSS][Z/±HH:mm]. *

*
    *
  • *

    * [YYYY]: year *

    *
  • *
  • *

    * [MM]: month *

    *
  • *
  • *

    * [DD]: day *

    *
  • *
  • *

    * [hh]: hour *

    *
  • *
  • *

    * [mm]: minute *

    *
  • *
  • *

    * [ss]: seconds *

    *
  • *
  • *

    * [.SSSSSSSSS]: additional precision, where precedence is maintained. For example: [.573123] is * equal to 573123000 nanoseconds. *

    *
  • *
  • *

    * Z: default timezone UTC *

    *
  • *
  • *

    * ± HH:mm: time zone offset in Hours and Minutes. *

    *
  • *
*

* Required sub-fields: YYYY-MM-DDThh:mm:ss and [Z/±HH:mm] */ public final String time() { return time; } /** *

* The timestamp of a value for a time series property. *

* * @return The timestamp of a value for a time series property. * @deprecated This field is deprecated and will throw an error in the future. Use time instead. */ @Deprecated public final Instant timestamp() { return timestamp; } /** *

* An object that specifies a value for a time series property. *

* * @return An object that specifies a value for a time series property. */ public final DataValue value() { return value; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public final int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(time()); hashCode = 31 * hashCode + Objects.hashCode(timestamp()); hashCode = 31 * hashCode + Objects.hashCode(value()); 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 PropertyValue)) { return false; } PropertyValue other = (PropertyValue) obj; return Objects.equals(time(), other.time()) && Objects.equals(timestamp(), other.timestamp()) && Objects.equals(value(), other.value()); } /** * 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("PropertyValue").add("Time", time()).add("Timestamp", timestamp()).add("Value", value()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "time": return Optional.ofNullable(clazz.cast(time())); case "timestamp": return Optional.ofNullable(clazz.cast(timestamp())); case "value": return Optional.ofNullable(clazz.cast(value())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((PropertyValue) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* ISO8601 DateTime of a value for a time series property. *

*

* The time for when the property value was recorded in ISO 8601 format: * YYYY-MM-DDThh:mm:ss[.SSSSSSSSS][Z/±HH:mm]. *

*
    *
  • *

    * [YYYY]: year *

    *
  • *
  • *

    * [MM]: month *

    *
  • *
  • *

    * [DD]: day *

    *
  • *
  • *

    * [hh]: hour *

    *
  • *
  • *

    * [mm]: minute *

    *
  • *
  • *

    * [ss]: seconds *

    *
  • *
  • *

    * [.SSSSSSSSS]: additional precision, where precedence is maintained. For example: [.573123] is equal to * 573123000 nanoseconds. *

    *
  • *
  • *

    * Z: default timezone UTC *

    *
  • *
  • *

    * ± HH:mm: time zone offset in Hours and Minutes. *

    *
  • *
*

* Required sub-fields: YYYY-MM-DDThh:mm:ss and [Z/±HH:mm] *

* * @param time * ISO8601 DateTime of a value for a time series property.

*

* The time for when the property value was recorded in ISO 8601 format: * YYYY-MM-DDThh:mm:ss[.SSSSSSSSS][Z/±HH:mm]. *

*
    *
  • *

    * [YYYY]: year *

    *
  • *
  • *

    * [MM]: month *

    *
  • *
  • *

    * [DD]: day *

    *
  • *
  • *

    * [hh]: hour *

    *
  • *
  • *

    * [mm]: minute *

    *
  • *
  • *

    * [ss]: seconds *

    *
  • *
  • *

    * [.SSSSSSSSS]: additional precision, where precedence is maintained. For example: [.573123] is * equal to 573123000 nanoseconds. *

    *
  • *
  • *

    * Z: default timezone UTC *

    *
  • *
  • *

    * ± HH:mm: time zone offset in Hours and Minutes. *

    *
  • *
*

* Required sub-fields: YYYY-MM-DDThh:mm:ss and [Z/±HH:mm] * @return Returns a reference to this object so that method calls can be chained together. */ Builder time(String time); /** *

* The timestamp of a value for a time series property. *

* * @param timestamp * The timestamp of a value for a time series property. * @return Returns a reference to this object so that method calls can be chained together. * @deprecated This field is deprecated and will throw an error in the future. Use time instead. */ @Deprecated Builder timestamp(Instant timestamp); /** *

* An object that specifies a value for a time series property. *

* * @param value * An object that specifies a value for a time series property. * @return Returns a reference to this object so that method calls can be chained together. */ Builder value(DataValue value); /** *

* An object that specifies a value for a time series property. *

* This is a convenience method that creates an instance of the {@link DataValue.Builder} avoiding the need to * create one manually via {@link DataValue#builder()}. * * When the {@link Consumer} completes, {@link DataValue.Builder#build()} is called immediately and its result * is passed to {@link #value(DataValue)}. * * @param value * a consumer that will call methods on {@link DataValue.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #value(DataValue) */ default Builder value(Consumer value) { return value(DataValue.builder().applyMutation(value).build()); } } static final class BuilderImpl implements Builder { private String time; private Instant timestamp; private DataValue value; private BuilderImpl() { } private BuilderImpl(PropertyValue model) { time(model.time); timestamp(model.timestamp); value(model.value); } public final String getTime() { return time; } public final void setTime(String time) { this.time = time; } @Override public final Builder time(String time) { this.time = time; return this; } @Deprecated public final Instant getTimestamp() { return timestamp; } @Deprecated public final void setTimestamp(Instant timestamp) { this.timestamp = timestamp; } @Override @Deprecated public final Builder timestamp(Instant timestamp) { this.timestamp = timestamp; return this; } public final DataValue.Builder getValue() { return value != null ? value.toBuilder() : null; } public final void setValue(DataValue.BuilderImpl value) { this.value = value != null ? value.build() : null; } @Override public final Builder value(DataValue value) { this.value = value; return this; } @Override public PropertyValue build() { return new PropertyValue(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy