software.amazon.awssdk.services.alexaforbusiness.model.ProfileData Maven / Gradle / Ivy
/*
* Copyright 2014-2019 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.alexaforbusiness.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;
/**
*
* The data of a room profile.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ProfileData implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField PROFILE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(ProfileData::profileArn)).setter(setter(Builder::profileArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ProfileArn").build()).build();
private static final SdkField PROFILE_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(ProfileData::profileName)).setter(setter(Builder::profileName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ProfileName").build()).build();
private static final SdkField IS_DEFAULT_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.getter(getter(ProfileData::isDefault)).setter(setter(Builder::isDefault))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("IsDefault").build()).build();
private static final SdkField ADDRESS_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(ProfileData::address)).setter(setter(Builder::address))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Address").build()).build();
private static final SdkField TIMEZONE_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(ProfileData::timezone)).setter(setter(Builder::timezone))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Timezone").build()).build();
private static final SdkField DISTANCE_UNIT_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(ProfileData::distanceUnitAsString)).setter(setter(Builder::distanceUnit))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DistanceUnit").build()).build();
private static final SdkField TEMPERATURE_UNIT_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(ProfileData::temperatureUnitAsString)).setter(setter(Builder::temperatureUnit))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TemperatureUnit").build()).build();
private static final SdkField WAKE_WORD_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(ProfileData::wakeWordAsString)).setter(setter(Builder::wakeWord))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("WakeWord").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(PROFILE_ARN_FIELD,
PROFILE_NAME_FIELD, IS_DEFAULT_FIELD, ADDRESS_FIELD, TIMEZONE_FIELD, DISTANCE_UNIT_FIELD, TEMPERATURE_UNIT_FIELD,
WAKE_WORD_FIELD));
private static final long serialVersionUID = 1L;
private final String profileArn;
private final String profileName;
private final Boolean isDefault;
private final String address;
private final String timezone;
private final String distanceUnit;
private final String temperatureUnit;
private final String wakeWord;
private ProfileData(BuilderImpl builder) {
this.profileArn = builder.profileArn;
this.profileName = builder.profileName;
this.isDefault = builder.isDefault;
this.address = builder.address;
this.timezone = builder.timezone;
this.distanceUnit = builder.distanceUnit;
this.temperatureUnit = builder.temperatureUnit;
this.wakeWord = builder.wakeWord;
}
/**
*
* The ARN of a room profile.
*
*
* @return The ARN of a room profile.
*/
public String profileArn() {
return profileArn;
}
/**
*
* The name of a room profile.
*
*
* @return The name of a room profile.
*/
public String profileName() {
return profileName;
}
/**
*
* Retrieves if the profile data is default or not.
*
*
* @return Retrieves if the profile data is default or not.
*/
public Boolean isDefault() {
return isDefault;
}
/**
*
* The address of a room profile.
*
*
* @return The address of a room profile.
*/
public String address() {
return address;
}
/**
*
* The timezone of a room profile.
*
*
* @return The timezone of a room profile.
*/
public String timezone() {
return timezone;
}
/**
*
* The distance unit of a room profile.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #distanceUnit} will
* return {@link DistanceUnit#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #distanceUnitAsString}.
*
*
* @return The distance unit of a room profile.
* @see DistanceUnit
*/
public DistanceUnit distanceUnit() {
return DistanceUnit.fromValue(distanceUnit);
}
/**
*
* The distance unit of a room profile.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #distanceUnit} will
* return {@link DistanceUnit#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #distanceUnitAsString}.
*
*
* @return The distance unit of a room profile.
* @see DistanceUnit
*/
public String distanceUnitAsString() {
return distanceUnit;
}
/**
*
* The temperature unit of a room profile.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #temperatureUnit}
* will return {@link TemperatureUnit#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #temperatureUnitAsString}.
*
*
* @return The temperature unit of a room profile.
* @see TemperatureUnit
*/
public TemperatureUnit temperatureUnit() {
return TemperatureUnit.fromValue(temperatureUnit);
}
/**
*
* The temperature unit of a room profile.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #temperatureUnit}
* will return {@link TemperatureUnit#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #temperatureUnitAsString}.
*
*
* @return The temperature unit of a room profile.
* @see TemperatureUnit
*/
public String temperatureUnitAsString() {
return temperatureUnit;
}
/**
*
* The wake word of a room profile.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #wakeWord} will
* return {@link WakeWord#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #wakeWordAsString}.
*
*
* @return The wake word of a room profile.
* @see WakeWord
*/
public WakeWord wakeWord() {
return WakeWord.fromValue(wakeWord);
}
/**
*
* The wake word of a room profile.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #wakeWord} will
* return {@link WakeWord#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #wakeWordAsString}.
*
*
* @return The wake word of a room profile.
* @see WakeWord
*/
public String wakeWordAsString() {
return wakeWord;
}
@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(profileArn());
hashCode = 31 * hashCode + Objects.hashCode(profileName());
hashCode = 31 * hashCode + Objects.hashCode(isDefault());
hashCode = 31 * hashCode + Objects.hashCode(address());
hashCode = 31 * hashCode + Objects.hashCode(timezone());
hashCode = 31 * hashCode + Objects.hashCode(distanceUnitAsString());
hashCode = 31 * hashCode + Objects.hashCode(temperatureUnitAsString());
hashCode = 31 * hashCode + Objects.hashCode(wakeWordAsString());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof ProfileData)) {
return false;
}
ProfileData other = (ProfileData) obj;
return Objects.equals(profileArn(), other.profileArn()) && Objects.equals(profileName(), other.profileName())
&& Objects.equals(isDefault(), other.isDefault()) && Objects.equals(address(), other.address())
&& Objects.equals(timezone(), other.timezone())
&& Objects.equals(distanceUnitAsString(), other.distanceUnitAsString())
&& Objects.equals(temperatureUnitAsString(), other.temperatureUnitAsString())
&& Objects.equals(wakeWordAsString(), other.wakeWordAsString());
}
/**
* 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("ProfileData").add("ProfileArn", profileArn()).add("ProfileName", profileName())
.add("IsDefault", isDefault()).add("Address", address()).add("Timezone", timezone())
.add("DistanceUnit", distanceUnitAsString()).add("TemperatureUnit", temperatureUnitAsString())
.add("WakeWord", wakeWordAsString()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "ProfileArn":
return Optional.ofNullable(clazz.cast(profileArn()));
case "ProfileName":
return Optional.ofNullable(clazz.cast(profileName()));
case "IsDefault":
return Optional.ofNullable(clazz.cast(isDefault()));
case "Address":
return Optional.ofNullable(clazz.cast(address()));
case "Timezone":
return Optional.ofNullable(clazz.cast(timezone()));
case "DistanceUnit":
return Optional.ofNullable(clazz.cast(distanceUnitAsString()));
case "TemperatureUnit":
return Optional.ofNullable(clazz.cast(temperatureUnitAsString()));
case "WakeWord":
return Optional.ofNullable(clazz.cast(wakeWordAsString()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function