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

software.amazon.awssdk.services.iotfleetwise.model.Attribute Maven / Gradle / Ivy

Go to download

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

There is a newer version: 2.29.39
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.iotfleetwise.model;

import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
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.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* A signal that represents static information about the vehicle, such as engine type or manufacturing date. *

*/ @Generated("software.amazon.awssdk:codegen") public final class Attribute implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField FULLY_QUALIFIED_NAME_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("fullyQualifiedName").getter(getter(Attribute::fullyQualifiedName)) .setter(setter(Builder::fullyQualifiedName)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("fullyQualifiedName").build()) .build(); private static final SdkField DATA_TYPE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("dataType").getter(getter(Attribute::dataTypeAsString)).setter(setter(Builder::dataType)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("dataType").build()).build(); private static final SdkField DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("description").getter(getter(Attribute::description)).setter(setter(Builder::description)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("description").build()).build(); private static final SdkField UNIT_FIELD = SdkField. builder(MarshallingType.STRING).memberName("unit") .getter(getter(Attribute::unit)).setter(setter(Builder::unit)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("unit").build()).build(); private static final SdkField> ALLOWED_VALUES_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("allowedValues") .getter(getter(Attribute::allowedValues)) .setter(setter(Builder::allowedValues)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("allowedValues").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.STRING) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField MIN_FIELD = SdkField. builder(MarshallingType.DOUBLE).memberName("min") .getter(getter(Attribute::min)).setter(setter(Builder::min)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("min").build()).build(); private static final SdkField MAX_FIELD = SdkField. builder(MarshallingType.DOUBLE).memberName("max") .getter(getter(Attribute::max)).setter(setter(Builder::max)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("max").build()).build(); private static final SdkField ASSIGNED_VALUE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("assignedValue").getter(getter(Attribute::assignedValue)).setter(setter(Builder::assignedValue)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("assignedValue").build()).build(); private static final SdkField DEFAULT_VALUE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("defaultValue").getter(getter(Attribute::defaultValue)).setter(setter(Builder::defaultValue)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("defaultValue").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(FULLY_QUALIFIED_NAME_FIELD, DATA_TYPE_FIELD, DESCRIPTION_FIELD, UNIT_FIELD, ALLOWED_VALUES_FIELD, MIN_FIELD, MAX_FIELD, ASSIGNED_VALUE_FIELD, DEFAULT_VALUE_FIELD)); private static final long serialVersionUID = 1L; private final String fullyQualifiedName; private final String dataType; private final String description; private final String unit; private final List allowedValues; private final Double min; private final Double max; private final String assignedValue; private final String defaultValue; private Attribute(BuilderImpl builder) { this.fullyQualifiedName = builder.fullyQualifiedName; this.dataType = builder.dataType; this.description = builder.description; this.unit = builder.unit; this.allowedValues = builder.allowedValues; this.min = builder.min; this.max = builder.max; this.assignedValue = builder.assignedValue; this.defaultValue = builder.defaultValue; } /** *

* The fully qualified name of the attribute. For example, the fully qualified name of an attribute might be * Vehicle.Body.Engine.Type. *

* * @return The fully qualified name of the attribute. For example, the fully qualified name of an attribute might be * Vehicle.Body.Engine.Type. */ public final String fullyQualifiedName() { return fullyQualifiedName; } /** *

* The specified data type of the attribute. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #dataType} will * return {@link NodeDataType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #dataTypeAsString}. *

* * @return The specified data type of the attribute. * @see NodeDataType */ public final NodeDataType dataType() { return NodeDataType.fromValue(dataType); } /** *

* The specified data type of the attribute. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #dataType} will * return {@link NodeDataType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #dataTypeAsString}. *

* * @return The specified data type of the attribute. * @see NodeDataType */ public final String dataTypeAsString() { return dataType; } /** *

* A brief description of the attribute. *

* * @return A brief description of the attribute. */ public final String description() { return description; } /** *

* The scientific unit for the attribute. *

* * @return The scientific unit for the attribute. */ public final String unit() { return unit; } /** * For responses, this returns true if the service returned a value for the AllowedValues property. This DOES NOT * check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). * This is useful because the SDK will never return a null collection or map, but you may need to differentiate * between the service returning nothing (or null) and the service returning an empty collection or map. For * requests, this returns true if a value for the property was specified in the request builder, and false if a * value was not specified. */ public final boolean hasAllowedValues() { return allowedValues != null && !(allowedValues instanceof SdkAutoConstructList); } /** *

* A list of possible values an attribute can be assigned. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* This method will never return null. If you would like to know whether the service returned this field (so that * you can differentiate between null and empty), you can use the {@link #hasAllowedValues} method. *

* * @return A list of possible values an attribute can be assigned. */ public final List allowedValues() { return allowedValues; } /** *

* The specified possible minimum value of the attribute. *

* * @return The specified possible minimum value of the attribute. */ public final Double min() { return min; } /** *

* The specified possible maximum value of the attribute. *

* * @return The specified possible maximum value of the attribute. */ public final Double max() { return max; } /** *

* A specified value for the attribute. *

* * @return A specified value for the attribute. */ public final String assignedValue() { return assignedValue; } /** *

* The default value of the attribute. *

* * @return The default value of the attribute. */ public final String defaultValue() { return defaultValue; } @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(fullyQualifiedName()); hashCode = 31 * hashCode + Objects.hashCode(dataTypeAsString()); hashCode = 31 * hashCode + Objects.hashCode(description()); hashCode = 31 * hashCode + Objects.hashCode(unit()); hashCode = 31 * hashCode + Objects.hashCode(hasAllowedValues() ? allowedValues() : null); hashCode = 31 * hashCode + Objects.hashCode(min()); hashCode = 31 * hashCode + Objects.hashCode(max()); hashCode = 31 * hashCode + Objects.hashCode(assignedValue()); hashCode = 31 * hashCode + Objects.hashCode(defaultValue()); 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 Attribute)) { return false; } Attribute other = (Attribute) obj; return Objects.equals(fullyQualifiedName(), other.fullyQualifiedName()) && Objects.equals(dataTypeAsString(), other.dataTypeAsString()) && Objects.equals(description(), other.description()) && Objects.equals(unit(), other.unit()) && hasAllowedValues() == other.hasAllowedValues() && Objects.equals(allowedValues(), other.allowedValues()) && Objects.equals(min(), other.min()) && Objects.equals(max(), other.max()) && Objects.equals(assignedValue(), other.assignedValue()) && Objects.equals(defaultValue(), other.defaultValue()); } /** * 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("Attribute").add("FullyQualifiedName", fullyQualifiedName()).add("DataType", dataTypeAsString()) .add("Description", description()).add("Unit", unit()) .add("AllowedValues", hasAllowedValues() ? allowedValues() : null).add("Min", min()).add("Max", max()) .add("AssignedValue", assignedValue()).add("DefaultValue", defaultValue()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "fullyQualifiedName": return Optional.ofNullable(clazz.cast(fullyQualifiedName())); case "dataType": return Optional.ofNullable(clazz.cast(dataTypeAsString())); case "description": return Optional.ofNullable(clazz.cast(description())); case "unit": return Optional.ofNullable(clazz.cast(unit())); case "allowedValues": return Optional.ofNullable(clazz.cast(allowedValues())); case "min": return Optional.ofNullable(clazz.cast(min())); case "max": return Optional.ofNullable(clazz.cast(max())); case "assignedValue": return Optional.ofNullable(clazz.cast(assignedValue())); case "defaultValue": return Optional.ofNullable(clazz.cast(defaultValue())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((Attribute) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The fully qualified name of the attribute. For example, the fully qualified name of an attribute might be * Vehicle.Body.Engine.Type. *

* * @param fullyQualifiedName * The fully qualified name of the attribute. For example, the fully qualified name of an attribute might * be Vehicle.Body.Engine.Type. * @return Returns a reference to this object so that method calls can be chained together. */ Builder fullyQualifiedName(String fullyQualifiedName); /** *

* The specified data type of the attribute. *

* * @param dataType * The specified data type of the attribute. * @see NodeDataType * @return Returns a reference to this object so that method calls can be chained together. * @see NodeDataType */ Builder dataType(String dataType); /** *

* The specified data type of the attribute. *

* * @param dataType * The specified data type of the attribute. * @see NodeDataType * @return Returns a reference to this object so that method calls can be chained together. * @see NodeDataType */ Builder dataType(NodeDataType dataType); /** *

* A brief description of the attribute. *

* * @param description * A brief description of the attribute. * @return Returns a reference to this object so that method calls can be chained together. */ Builder description(String description); /** *

* The scientific unit for the attribute. *

* * @param unit * The scientific unit for the attribute. * @return Returns a reference to this object so that method calls can be chained together. */ Builder unit(String unit); /** *

* A list of possible values an attribute can be assigned. *

* * @param allowedValues * A list of possible values an attribute can be assigned. * @return Returns a reference to this object so that method calls can be chained together. */ Builder allowedValues(Collection allowedValues); /** *

* A list of possible values an attribute can be assigned. *

* * @param allowedValues * A list of possible values an attribute can be assigned. * @return Returns a reference to this object so that method calls can be chained together. */ Builder allowedValues(String... allowedValues); /** *

* The specified possible minimum value of the attribute. *

* * @param min * The specified possible minimum value of the attribute. * @return Returns a reference to this object so that method calls can be chained together. */ Builder min(Double min); /** *

* The specified possible maximum value of the attribute. *

* * @param max * The specified possible maximum value of the attribute. * @return Returns a reference to this object so that method calls can be chained together. */ Builder max(Double max); /** *

* A specified value for the attribute. *

* * @param assignedValue * A specified value for the attribute. * @return Returns a reference to this object so that method calls can be chained together. */ Builder assignedValue(String assignedValue); /** *

* The default value of the attribute. *

* * @param defaultValue * The default value of the attribute. * @return Returns a reference to this object so that method calls can be chained together. */ Builder defaultValue(String defaultValue); } static final class BuilderImpl implements Builder { private String fullyQualifiedName; private String dataType; private String description; private String unit; private List allowedValues = DefaultSdkAutoConstructList.getInstance(); private Double min; private Double max; private String assignedValue; private String defaultValue; private BuilderImpl() { } private BuilderImpl(Attribute model) { fullyQualifiedName(model.fullyQualifiedName); dataType(model.dataType); description(model.description); unit(model.unit); allowedValues(model.allowedValues); min(model.min); max(model.max); assignedValue(model.assignedValue); defaultValue(model.defaultValue); } public final String getFullyQualifiedName() { return fullyQualifiedName; } public final void setFullyQualifiedName(String fullyQualifiedName) { this.fullyQualifiedName = fullyQualifiedName; } @Override public final Builder fullyQualifiedName(String fullyQualifiedName) { this.fullyQualifiedName = fullyQualifiedName; return this; } public final String getDataType() { return dataType; } public final void setDataType(String dataType) { this.dataType = dataType; } @Override public final Builder dataType(String dataType) { this.dataType = dataType; return this; } @Override public final Builder dataType(NodeDataType dataType) { this.dataType(dataType == null ? null : dataType.toString()); return this; } public final String getDescription() { return description; } public final void setDescription(String description) { this.description = description; } @Override public final Builder description(String description) { this.description = description; return this; } public final String getUnit() { return unit; } public final void setUnit(String unit) { this.unit = unit; } @Override public final Builder unit(String unit) { this.unit = unit; return this; } public final Collection getAllowedValues() { if (allowedValues instanceof SdkAutoConstructList) { return null; } return allowedValues; } public final void setAllowedValues(Collection allowedValues) { this.allowedValues = _listOfStringsCopier.copy(allowedValues); } @Override public final Builder allowedValues(Collection allowedValues) { this.allowedValues = _listOfStringsCopier.copy(allowedValues); return this; } @Override @SafeVarargs public final Builder allowedValues(String... allowedValues) { allowedValues(Arrays.asList(allowedValues)); return this; } public final Double getMin() { return min; } public final void setMin(Double min) { this.min = min; } @Override public final Builder min(Double min) { this.min = min; return this; } public final Double getMax() { return max; } public final void setMax(Double max) { this.max = max; } @Override public final Builder max(Double max) { this.max = max; return this; } public final String getAssignedValue() { return assignedValue; } public final void setAssignedValue(String assignedValue) { this.assignedValue = assignedValue; } @Override public final Builder assignedValue(String assignedValue) { this.assignedValue = assignedValue; return this; } public final String getDefaultValue() { return defaultValue; } public final void setDefaultValue(String defaultValue) { this.defaultValue = defaultValue; } @Override public final Builder defaultValue(String defaultValue) { this.defaultValue = defaultValue; return this; } @Override public Attribute build() { return new Attribute(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy