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

software.amazon.awssdk.services.iottwinmaker.model.PropertyDefinitionResponse 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.28.8
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 contains response data from a property definition request. *

*/ @Generated("software.amazon.awssdk:codegen") public final class PropertyDefinitionResponse implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField DATA_TYPE_FIELD = SdkField. builder(MarshallingType.SDK_POJO) .memberName("dataType").getter(getter(PropertyDefinitionResponse::dataType)).setter(setter(Builder::dataType)) .constructor(DataType::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("dataType").build()).build(); private static final SdkField IS_TIME_SERIES_FIELD = SdkField. builder(MarshallingType.BOOLEAN) .memberName("isTimeSeries").getter(getter(PropertyDefinitionResponse::isTimeSeries)) .setter(setter(Builder::isTimeSeries)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("isTimeSeries").build()).build(); private static final SdkField IS_REQUIRED_IN_ENTITY_FIELD = SdkField. builder(MarshallingType.BOOLEAN) .memberName("isRequiredInEntity").getter(getter(PropertyDefinitionResponse::isRequiredInEntity)) .setter(setter(Builder::isRequiredInEntity)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("isRequiredInEntity").build()) .build(); private static final SdkField IS_EXTERNAL_ID_FIELD = SdkField. builder(MarshallingType.BOOLEAN) .memberName("isExternalId").getter(getter(PropertyDefinitionResponse::isExternalId)) .setter(setter(Builder::isExternalId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("isExternalId").build()).build(); private static final SdkField IS_STORED_EXTERNALLY_FIELD = SdkField. builder(MarshallingType.BOOLEAN) .memberName("isStoredExternally").getter(getter(PropertyDefinitionResponse::isStoredExternally)) .setter(setter(Builder::isStoredExternally)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("isStoredExternally").build()) .build(); private static final SdkField IS_IMPORTED_FIELD = SdkField. builder(MarshallingType.BOOLEAN) .memberName("isImported").getter(getter(PropertyDefinitionResponse::isImported)).setter(setter(Builder::isImported)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("isImported").build()).build(); private static final SdkField IS_FINAL_FIELD = SdkField. builder(MarshallingType.BOOLEAN) .memberName("isFinal").getter(getter(PropertyDefinitionResponse::isFinal)).setter(setter(Builder::isFinal)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("isFinal").build()).build(); private static final SdkField IS_INHERITED_FIELD = SdkField. builder(MarshallingType.BOOLEAN) .memberName("isInherited").getter(getter(PropertyDefinitionResponse::isInherited)) .setter(setter(Builder::isInherited)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("isInherited").build()).build(); private static final SdkField DEFAULT_VALUE_FIELD = SdkField. builder(MarshallingType.SDK_POJO) .memberName("defaultValue").getter(getter(PropertyDefinitionResponse::defaultValue)) .setter(setter(Builder::defaultValue)).constructor(DataValue::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("defaultValue").build()).build(); private static final SdkField> CONFIGURATION_FIELD = SdkField .> builder(MarshallingType.MAP) .memberName("configuration") .getter(getter(PropertyDefinitionResponse::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 DISPLAY_NAME_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("displayName").getter(getter(PropertyDefinitionResponse::displayName)) .setter(setter(Builder::displayName)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("displayName").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(DATA_TYPE_FIELD, IS_TIME_SERIES_FIELD, IS_REQUIRED_IN_ENTITY_FIELD, IS_EXTERNAL_ID_FIELD, IS_STORED_EXTERNALLY_FIELD, IS_IMPORTED_FIELD, IS_FINAL_FIELD, IS_INHERITED_FIELD, DEFAULT_VALUE_FIELD, CONFIGURATION_FIELD, DISPLAY_NAME_FIELD)); private static final long serialVersionUID = 1L; private final DataType dataType; private final Boolean isTimeSeries; private final Boolean isRequiredInEntity; private final Boolean isExternalId; private final Boolean isStoredExternally; private final Boolean isImported; private final Boolean isFinal; private final Boolean isInherited; private final DataValue defaultValue; private final Map configuration; private final String displayName; private PropertyDefinitionResponse(BuilderImpl builder) { this.dataType = builder.dataType; this.isTimeSeries = builder.isTimeSeries; this.isRequiredInEntity = builder.isRequiredInEntity; this.isExternalId = builder.isExternalId; this.isStoredExternally = builder.isStoredExternally; this.isImported = builder.isImported; this.isFinal = builder.isFinal; this.isInherited = builder.isInherited; this.defaultValue = builder.defaultValue; this.configuration = builder.configuration; this.displayName = builder.displayName; } /** *

* 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; } /** *

* 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; } /** *

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

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

* 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 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 definition is imported from an external data store. *

* * @return A Boolean value that specifies whether the property definition is imported from an external data store. */ public final Boolean isImported() { return isImported; } /** *

* A Boolean value that specifies whether the property definition can be updated. *

* * @return A Boolean value that specifies whether the property definition can be updated. */ public final Boolean isFinal() { return isFinal; } /** *

* A Boolean value that specifies whether the property definition is inherited from a parent entity. *

* * @return A Boolean value that specifies whether the property definition is inherited from a parent entity. */ public final Boolean isInherited() { return isInherited; } /** *

* An object that contains the default value. *

* * @return An object that contains the default value. */ public final DataValue defaultValue() { return defaultValue; } /** * 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. *

*

* 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. */ public final Map configuration() { return configuration; } /** *

* A friendly name for the property. *

* * @return A friendly name for the property. */ public final String displayName() { return displayName; } @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(dataType()); hashCode = 31 * hashCode + Objects.hashCode(isTimeSeries()); hashCode = 31 * hashCode + Objects.hashCode(isRequiredInEntity()); hashCode = 31 * hashCode + Objects.hashCode(isExternalId()); hashCode = 31 * hashCode + Objects.hashCode(isStoredExternally()); hashCode = 31 * hashCode + Objects.hashCode(isImported()); hashCode = 31 * hashCode + Objects.hashCode(isFinal()); hashCode = 31 * hashCode + Objects.hashCode(isInherited()); hashCode = 31 * hashCode + Objects.hashCode(defaultValue()); hashCode = 31 * hashCode + Objects.hashCode(hasConfiguration() ? configuration() : null); hashCode = 31 * hashCode + Objects.hashCode(displayName()); 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 PropertyDefinitionResponse)) { return false; } PropertyDefinitionResponse other = (PropertyDefinitionResponse) obj; return Objects.equals(dataType(), other.dataType()) && Objects.equals(isTimeSeries(), other.isTimeSeries()) && Objects.equals(isRequiredInEntity(), other.isRequiredInEntity()) && Objects.equals(isExternalId(), other.isExternalId()) && Objects.equals(isStoredExternally(), other.isStoredExternally()) && Objects.equals(isImported(), other.isImported()) && Objects.equals(isFinal(), other.isFinal()) && Objects.equals(isInherited(), other.isInherited()) && Objects.equals(defaultValue(), other.defaultValue()) && hasConfiguration() == other.hasConfiguration() && Objects.equals(configuration(), other.configuration()) && Objects.equals(displayName(), other.displayName()); } /** * 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("PropertyDefinitionResponse").add("DataType", dataType()).add("IsTimeSeries", isTimeSeries()) .add("IsRequiredInEntity", isRequiredInEntity()).add("IsExternalId", isExternalId()) .add("IsStoredExternally", isStoredExternally()).add("IsImported", isImported()).add("IsFinal", isFinal()) .add("IsInherited", isInherited()).add("DefaultValue", defaultValue()) .add("Configuration", hasConfiguration() ? configuration() : null).add("DisplayName", displayName()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "dataType": return Optional.ofNullable(clazz.cast(dataType())); case "isTimeSeries": return Optional.ofNullable(clazz.cast(isTimeSeries())); case "isRequiredInEntity": return Optional.ofNullable(clazz.cast(isRequiredInEntity())); case "isExternalId": return Optional.ofNullable(clazz.cast(isExternalId())); case "isStoredExternally": return Optional.ofNullable(clazz.cast(isStoredExternally())); case "isImported": return Optional.ofNullable(clazz.cast(isImported())); case "isFinal": return Optional.ofNullable(clazz.cast(isFinal())); case "isInherited": return Optional.ofNullable(clazz.cast(isInherited())); case "defaultValue": return Optional.ofNullable(clazz.cast(defaultValue())); case "configuration": return Optional.ofNullable(clazz.cast(configuration())); case "displayName": return Optional.ofNullable(clazz.cast(displayName())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((PropertyDefinitionResponse) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* 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()); } /** *

* 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); /** *

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

* * @param isRequiredInEntity * A Boolean value that specifies whether the property is required in an entity. * @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 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 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 definition is imported from an external data store. *

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

* A Boolean value that specifies whether the property definition can be updated. *

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

* A Boolean value that specifies whether the property definition is inherited from a parent entity. *

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

* 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 mapping that specifies configuration information about the property. *

* * @param configuration * A mapping that specifies configuration information about the property. * @return Returns a reference to this object so that method calls can be chained together. */ Builder configuration(Map configuration); /** *

* A friendly name for the property. *

* * @param displayName * A friendly name for the property. * @return Returns a reference to this object so that method calls can be chained together. */ Builder displayName(String displayName); } static final class BuilderImpl implements Builder { private DataType dataType; private Boolean isTimeSeries; private Boolean isRequiredInEntity; private Boolean isExternalId; private Boolean isStoredExternally; private Boolean isImported; private Boolean isFinal; private Boolean isInherited; private DataValue defaultValue; private Map configuration = DefaultSdkAutoConstructMap.getInstance(); private String displayName; private BuilderImpl() { } private BuilderImpl(PropertyDefinitionResponse model) { dataType(model.dataType); isTimeSeries(model.isTimeSeries); isRequiredInEntity(model.isRequiredInEntity); isExternalId(model.isExternalId); isStoredExternally(model.isStoredExternally); isImported(model.isImported); isFinal(model.isFinal); isInherited(model.isInherited); defaultValue(model.defaultValue); configuration(model.configuration); displayName(model.displayName); } 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 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; } 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 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 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 getIsImported() { return isImported; } public final void setIsImported(Boolean isImported) { this.isImported = isImported; } @Override public final Builder isImported(Boolean isImported) { this.isImported = isImported; return this; } public final Boolean getIsFinal() { return isFinal; } public final void setIsFinal(Boolean isFinal) { this.isFinal = isFinal; } @Override public final Builder isFinal(Boolean isFinal) { this.isFinal = isFinal; return this; } public final Boolean getIsInherited() { return isInherited; } public final void setIsInherited(Boolean isInherited) { this.isInherited = isInherited; } @Override public final Builder isInherited(Boolean isInherited) { this.isInherited = isInherited; 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 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 String getDisplayName() { return displayName; } public final void setDisplayName(String displayName) { this.displayName = displayName; } @Override public final Builder displayName(String displayName) { this.displayName = displayName; return this; } @Override public PropertyDefinitionResponse build() { return new PropertyDefinitionResponse(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy