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

software.amazon.awssdk.services.iottwinmaker.model.PropertyDefinitionRequest 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.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
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.core.traits.MapTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
import software.amazon.awssdk.core.util.SdkAutoConstructMap;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* An object that sets information about a property. *

*/ @Generated("software.amazon.awssdk:codegen") public final class PropertyDefinitionRequest implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField> CONFIGURATION_FIELD = SdkField .> builder(MarshallingType.MAP) .memberName("configuration") .getter(getter(PropertyDefinitionRequest::configuration)) .setter(setter(Builder::configuration)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("configuration").build(), MapTrait.builder() .keyLocationName("key") .valueLocationName("value") .valueFieldInfo( SdkField. builder(MarshallingType.STRING) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("value").build()).build()).build()).build(); private static final SdkField DATA_TYPE_FIELD = SdkField. builder(MarshallingType.SDK_POJO) .memberName("dataType").getter(getter(PropertyDefinitionRequest::dataType)).setter(setter(Builder::dataType)) .constructor(DataType::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("dataType").build()).build(); private static final SdkField DEFAULT_VALUE_FIELD = SdkField. builder(MarshallingType.SDK_POJO) .memberName("defaultValue").getter(getter(PropertyDefinitionRequest::defaultValue)) .setter(setter(Builder::defaultValue)).constructor(DataValue::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("defaultValue").build()).build(); private static final SdkField IS_EXTERNAL_ID_FIELD = SdkField. builder(MarshallingType.BOOLEAN) .memberName("isExternalId").getter(getter(PropertyDefinitionRequest::isExternalId)) .setter(setter(Builder::isExternalId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("isExternalId").build()).build(); private static final SdkField IS_REQUIRED_IN_ENTITY_FIELD = SdkField. builder(MarshallingType.BOOLEAN) .memberName("isRequiredInEntity").getter(getter(PropertyDefinitionRequest::isRequiredInEntity)) .setter(setter(Builder::isRequiredInEntity)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("isRequiredInEntity").build()) .build(); private static final SdkField IS_STORED_EXTERNALLY_FIELD = SdkField. builder(MarshallingType.BOOLEAN) .memberName("isStoredExternally").getter(getter(PropertyDefinitionRequest::isStoredExternally)) .setter(setter(Builder::isStoredExternally)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("isStoredExternally").build()) .build(); private static final SdkField IS_TIME_SERIES_FIELD = SdkField. builder(MarshallingType.BOOLEAN) .memberName("isTimeSeries").getter(getter(PropertyDefinitionRequest::isTimeSeries)) .setter(setter(Builder::isTimeSeries)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("isTimeSeries").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CONFIGURATION_FIELD, DATA_TYPE_FIELD, DEFAULT_VALUE_FIELD, IS_EXTERNAL_ID_FIELD, IS_REQUIRED_IN_ENTITY_FIELD, IS_STORED_EXTERNALLY_FIELD, IS_TIME_SERIES_FIELD)); private static final long serialVersionUID = 1L; private final Map configuration; private final DataType dataType; private final DataValue defaultValue; private final Boolean isExternalId; private final Boolean isRequiredInEntity; private final Boolean isStoredExternally; private final Boolean isTimeSeries; private PropertyDefinitionRequest(BuilderImpl builder) { this.configuration = builder.configuration; this.dataType = builder.dataType; this.defaultValue = builder.defaultValue; this.isExternalId = builder.isExternalId; this.isRequiredInEntity = builder.isRequiredInEntity; this.isStoredExternally = builder.isStoredExternally; this.isTimeSeries = builder.isTimeSeries; } /** * For responses, this returns true if the service returned a value for the Configuration 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 hasConfiguration() { return configuration != null && !(configuration instanceof SdkAutoConstructMap); } /** *

* A mapping that specifies configuration information about the property. Use this field to specify information that * you read from and write to an external source. *

*

* 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 #hasConfiguration} method. *

* * @return A mapping that specifies configuration information about the property. Use this field to specify * information that you read from and write to an external source. */ public final Map configuration() { return configuration; } /** *

* An object that contains information about the data type. *

* * @return An object that contains information about the data type. */ public final DataType dataType() { return dataType; } /** *

* An object that contains the default value. *

* * @return An object that contains the default value. */ public final DataValue defaultValue() { return defaultValue; } /** *

* A Boolean value that specifies whether the property ID comes from an external data store. *

* * @return A Boolean value that specifies whether the property ID comes from an external data store. */ public final Boolean isExternalId() { return isExternalId; } /** *

* A Boolean value that specifies whether the property is required. *

* * @return A Boolean value that specifies whether the property is required. */ public final Boolean isRequiredInEntity() { return isRequiredInEntity; } /** *

* A Boolean value that specifies whether the property is stored externally. *

* * @return A Boolean value that specifies whether the property is stored externally. */ public final Boolean isStoredExternally() { return isStoredExternally; } /** *

* A Boolean value that specifies whether the property consists of time series data. *

* * @return A Boolean value that specifies whether the property consists of time series data. */ public final Boolean isTimeSeries() { return isTimeSeries; } @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(hasConfiguration() ? configuration() : null); hashCode = 31 * hashCode + Objects.hashCode(dataType()); hashCode = 31 * hashCode + Objects.hashCode(defaultValue()); hashCode = 31 * hashCode + Objects.hashCode(isExternalId()); hashCode = 31 * hashCode + Objects.hashCode(isRequiredInEntity()); hashCode = 31 * hashCode + Objects.hashCode(isStoredExternally()); hashCode = 31 * hashCode + Objects.hashCode(isTimeSeries()); 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 PropertyDefinitionRequest)) { return false; } PropertyDefinitionRequest other = (PropertyDefinitionRequest) obj; return hasConfiguration() == other.hasConfiguration() && Objects.equals(configuration(), other.configuration()) && Objects.equals(dataType(), other.dataType()) && Objects.equals(defaultValue(), other.defaultValue()) && Objects.equals(isExternalId(), other.isExternalId()) && Objects.equals(isRequiredInEntity(), other.isRequiredInEntity()) && Objects.equals(isStoredExternally(), other.isStoredExternally()) && Objects.equals(isTimeSeries(), other.isTimeSeries()); } /** * 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("PropertyDefinitionRequest").add("Configuration", hasConfiguration() ? configuration() : null) .add("DataType", dataType()).add("DefaultValue", defaultValue()).add("IsExternalId", isExternalId()) .add("IsRequiredInEntity", isRequiredInEntity()).add("IsStoredExternally", isStoredExternally()) .add("IsTimeSeries", isTimeSeries()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "configuration": return Optional.ofNullable(clazz.cast(configuration())); case "dataType": return Optional.ofNullable(clazz.cast(dataType())); case "defaultValue": return Optional.ofNullable(clazz.cast(defaultValue())); case "isExternalId": return Optional.ofNullable(clazz.cast(isExternalId())); case "isRequiredInEntity": return Optional.ofNullable(clazz.cast(isRequiredInEntity())); case "isStoredExternally": return Optional.ofNullable(clazz.cast(isStoredExternally())); case "isTimeSeries": return Optional.ofNullable(clazz.cast(isTimeSeries())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((PropertyDefinitionRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* A mapping that specifies configuration information about the property. Use this field to specify information * that you read from and write to an external source. *

* * @param configuration * A mapping that specifies configuration information about the property. Use this field to specify * information that you read from and write to an external source. * @return Returns a reference to this object so that method calls can be chained together. */ Builder configuration(Map configuration); /** *

* An object that contains information about the data type. *

* * @param dataType * An object that contains information about the data type. * @return Returns a reference to this object so that method calls can be chained together. */ Builder dataType(DataType dataType); /** *

* An object that contains information about the data type. *

* This is a convenience method that creates an instance of the {@link DataType.Builder} avoiding the need to * create one manually via {@link DataType#builder()}. * * When the {@link Consumer} completes, {@link DataType.Builder#build()} is called immediately and its result is * passed to {@link #dataType(DataType)}. * * @param dataType * a consumer that will call methods on {@link DataType.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #dataType(DataType) */ default Builder dataType(Consumer dataType) { return dataType(DataType.builder().applyMutation(dataType).build()); } /** *

* An object that contains the default value. *

* * @param defaultValue * An object that contains the default value. * @return Returns a reference to this object so that method calls can be chained together. */ Builder defaultValue(DataValue defaultValue); /** *

* An object that contains the default value. *

* 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 #defaultValue(DataValue)}. * * @param defaultValue * 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 #defaultValue(DataValue) */ default Builder defaultValue(Consumer defaultValue) { return defaultValue(DataValue.builder().applyMutation(defaultValue).build()); } /** *

* A Boolean value that specifies whether the property ID comes from an external data store. *

* * @param isExternalId * A Boolean value that specifies whether the property ID comes from an external data store. * @return Returns a reference to this object so that method calls can be chained together. */ Builder isExternalId(Boolean isExternalId); /** *

* A Boolean value that specifies whether the property is required. *

* * @param isRequiredInEntity * A Boolean value that specifies whether the property is required. * @return Returns a reference to this object so that method calls can be chained together. */ Builder isRequiredInEntity(Boolean isRequiredInEntity); /** *

* A Boolean value that specifies whether the property is stored externally. *

* * @param isStoredExternally * A Boolean value that specifies whether the property is stored externally. * @return Returns a reference to this object so that method calls can be chained together. */ Builder isStoredExternally(Boolean isStoredExternally); /** *

* A Boolean value that specifies whether the property consists of time series data. *

* * @param isTimeSeries * A Boolean value that specifies whether the property consists of time series data. * @return Returns a reference to this object so that method calls can be chained together. */ Builder isTimeSeries(Boolean isTimeSeries); } static final class BuilderImpl implements Builder { private Map configuration = DefaultSdkAutoConstructMap.getInstance(); private DataType dataType; private DataValue defaultValue; private Boolean isExternalId; private Boolean isRequiredInEntity; private Boolean isStoredExternally; private Boolean isTimeSeries; private BuilderImpl() { } private BuilderImpl(PropertyDefinitionRequest model) { configuration(model.configuration); dataType(model.dataType); defaultValue(model.defaultValue); isExternalId(model.isExternalId); isRequiredInEntity(model.isRequiredInEntity); isStoredExternally(model.isStoredExternally); isTimeSeries(model.isTimeSeries); } public final Map getConfiguration() { if (configuration instanceof SdkAutoConstructMap) { return null; } return configuration; } public final void setConfiguration(Map configuration) { this.configuration = ConfigurationCopier.copy(configuration); } @Override public final Builder configuration(Map configuration) { this.configuration = ConfigurationCopier.copy(configuration); return this; } public final DataType.Builder getDataType() { return dataType != null ? dataType.toBuilder() : null; } public final void setDataType(DataType.BuilderImpl dataType) { this.dataType = dataType != null ? dataType.build() : null; } @Override public final Builder dataType(DataType dataType) { this.dataType = dataType; return this; } public final DataValue.Builder getDefaultValue() { return defaultValue != null ? defaultValue.toBuilder() : null; } public final void setDefaultValue(DataValue.BuilderImpl defaultValue) { this.defaultValue = defaultValue != null ? defaultValue.build() : null; } @Override public final Builder defaultValue(DataValue defaultValue) { this.defaultValue = defaultValue; return this; } public final Boolean getIsExternalId() { return isExternalId; } public final void setIsExternalId(Boolean isExternalId) { this.isExternalId = isExternalId; } @Override public final Builder isExternalId(Boolean isExternalId) { this.isExternalId = isExternalId; return this; } public final Boolean getIsRequiredInEntity() { return isRequiredInEntity; } public final void setIsRequiredInEntity(Boolean isRequiredInEntity) { this.isRequiredInEntity = isRequiredInEntity; } @Override public final Builder isRequiredInEntity(Boolean isRequiredInEntity) { this.isRequiredInEntity = isRequiredInEntity; return this; } public final Boolean getIsStoredExternally() { return isStoredExternally; } public final void setIsStoredExternally(Boolean isStoredExternally) { this.isStoredExternally = isStoredExternally; } @Override public final Builder isStoredExternally(Boolean isStoredExternally) { this.isStoredExternally = isStoredExternally; return this; } public final Boolean getIsTimeSeries() { return isTimeSeries; } public final void setIsTimeSeries(Boolean isTimeSeries) { this.isTimeSeries = isTimeSeries; } @Override public final Builder isTimeSeries(Boolean isTimeSeries) { this.isTimeSeries = isTimeSeries; return this; } @Override public PropertyDefinitionRequest build() { return new PropertyDefinitionRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy