software.amazon.awssdk.services.connect.model.HoursOfOperationConfig Maven / Gradle / Ivy
Show all versions of connect Show documentation
/*
* 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.connect.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.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;
/**
*
* Contains information about the hours of operation.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class HoursOfOperationConfig implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField DAY_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Day")
.getter(getter(HoursOfOperationConfig::dayAsString)).setter(setter(Builder::day))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Day").build()).build();
private static final SdkField START_TIME_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("StartTime")
.getter(getter(HoursOfOperationConfig::startTime)).setter(setter(Builder::startTime))
.constructor(HoursOfOperationTimeSlice::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StartTime").build()).build();
private static final SdkField END_TIME_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("EndTime")
.getter(getter(HoursOfOperationConfig::endTime)).setter(setter(Builder::endTime))
.constructor(HoursOfOperationTimeSlice::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EndTime").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(DAY_FIELD, START_TIME_FIELD,
END_TIME_FIELD));
private static final long serialVersionUID = 1L;
private final String day;
private final HoursOfOperationTimeSlice startTime;
private final HoursOfOperationTimeSlice endTime;
private HoursOfOperationConfig(BuilderImpl builder) {
this.day = builder.day;
this.startTime = builder.startTime;
this.endTime = builder.endTime;
}
/**
*
* The day that the hours of operation applies to.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #day} will return
* {@link HoursOfOperationDays#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #dayAsString}.
*
*
* @return The day that the hours of operation applies to.
* @see HoursOfOperationDays
*/
public final HoursOfOperationDays day() {
return HoursOfOperationDays.fromValue(day);
}
/**
*
* The day that the hours of operation applies to.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #day} will return
* {@link HoursOfOperationDays#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #dayAsString}.
*
*
* @return The day that the hours of operation applies to.
* @see HoursOfOperationDays
*/
public final String dayAsString() {
return day;
}
/**
*
* The start time that your contact center opens.
*
*
* @return The start time that your contact center opens.
*/
public final HoursOfOperationTimeSlice startTime() {
return startTime;
}
/**
*
* The end time that your contact center closes.
*
*
* @return The end time that your contact center closes.
*/
public final HoursOfOperationTimeSlice endTime() {
return endTime;
}
@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 final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(dayAsString());
hashCode = 31 * hashCode + Objects.hashCode(startTime());
hashCode = 31 * hashCode + Objects.hashCode(endTime());
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 HoursOfOperationConfig)) {
return false;
}
HoursOfOperationConfig other = (HoursOfOperationConfig) obj;
return Objects.equals(dayAsString(), other.dayAsString()) && Objects.equals(startTime(), other.startTime())
&& Objects.equals(endTime(), other.endTime());
}
/**
* 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("HoursOfOperationConfig").add("Day", dayAsString()).add("StartTime", startTime())
.add("EndTime", endTime()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Day":
return Optional.ofNullable(clazz.cast(dayAsString()));
case "StartTime":
return Optional.ofNullable(clazz.cast(startTime()));
case "EndTime":
return Optional.ofNullable(clazz.cast(endTime()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function