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

software.amazon.awssdk.services.pinpoint.model.OpenHours Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon Pinpoint module holds the client classes that are used for communicating with Amazon Pinpoint Service

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

import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
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.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.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;

/**
 * 

* The time when journey allow to send messages. QuietTime should be configured first and SendingSchedule should be set * to true. *

*/ @Generated("software.amazon.awssdk:codegen") public final class OpenHours implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField>> EMAIL_FIELD = SdkField .>> builder(MarshallingType.MAP) .memberName("EMAIL") .getter(getter(OpenHours::emailAsStrings)) .setter(setter(Builder::emailWithStrings)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EMAIL").build(), MapTrait.builder() .keyLocationName("key") .valueLocationName("value") .valueFieldInfo( SdkField.> builder(MarshallingType.LIST) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("value").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(OpenHoursRule::builder) .traits(LocationTrait.builder() .location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()) .build()).build()).build()).build(); private static final SdkField>> SMS_FIELD = SdkField .>> builder(MarshallingType.MAP) .memberName("SMS") .getter(getter(OpenHours::smsAsStrings)) .setter(setter(Builder::smsWithStrings)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SMS").build(), MapTrait.builder() .keyLocationName("key") .valueLocationName("value") .valueFieldInfo( SdkField.> builder(MarshallingType.LIST) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("value").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(OpenHoursRule::builder) .traits(LocationTrait.builder() .location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()) .build()).build()).build()).build(); private static final SdkField>> PUSH_FIELD = SdkField .>> builder(MarshallingType.MAP) .memberName("PUSH") .getter(getter(OpenHours::pushAsStrings)) .setter(setter(Builder::pushWithStrings)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PUSH").build(), MapTrait.builder() .keyLocationName("key") .valueLocationName("value") .valueFieldInfo( SdkField.> builder(MarshallingType.LIST) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("value").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(OpenHoursRule::builder) .traits(LocationTrait.builder() .location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()) .build()).build()).build()).build(); private static final SdkField>> VOICE_FIELD = SdkField .>> builder(MarshallingType.MAP) .memberName("VOICE") .getter(getter(OpenHours::voiceAsStrings)) .setter(setter(Builder::voiceWithStrings)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VOICE").build(), MapTrait.builder() .keyLocationName("key") .valueLocationName("value") .valueFieldInfo( SdkField.> builder(MarshallingType.LIST) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("value").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(OpenHoursRule::builder) .traits(LocationTrait.builder() .location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()) .build()).build()).build()).build(); private static final SdkField>> CUSTOM_FIELD = SdkField .>> builder(MarshallingType.MAP) .memberName("CUSTOM") .getter(getter(OpenHours::customAsStrings)) .setter(setter(Builder::customWithStrings)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CUSTOM").build(), MapTrait.builder() .keyLocationName("key") .valueLocationName("value") .valueFieldInfo( SdkField.> builder(MarshallingType.LIST) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("value").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(OpenHoursRule::builder) .traits(LocationTrait.builder() .location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()) .build()).build()).build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(EMAIL_FIELD, SMS_FIELD, PUSH_FIELD, VOICE_FIELD, CUSTOM_FIELD)); private static final long serialVersionUID = 1L; private final Map> email; private final Map> sms; private final Map> push; private final Map> voice; private final Map> custom; private OpenHours(BuilderImpl builder) { this.email = builder.email; this.sms = builder.sms; this.push = builder.push; this.voice = builder.voice; this.custom = builder.custom; } /** *

* Rules for Email Channel. *

*

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

* * @return Rules for Email Channel. */ public final Map> email() { return MapOfListOfOpenHoursRulesCopier.copyStringToEnum(email); } /** * For responses, this returns true if the service returned a value for the EMAIL 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 hasEmail() { return email != null && !(email instanceof SdkAutoConstructMap); } /** *

* Rules for Email Channel. *

*

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

* * @return Rules for Email Channel. */ public final Map> emailAsStrings() { return email; } /** *

* Rules for SMS Channel. *

*

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

* * @return Rules for SMS Channel. */ public final Map> sms() { return MapOfListOfOpenHoursRulesCopier.copyStringToEnum(sms); } /** * For responses, this returns true if the service returned a value for the SMS 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 hasSms() { return sms != null && !(sms instanceof SdkAutoConstructMap); } /** *

* Rules for SMS Channel. *

*

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

* * @return Rules for SMS Channel. */ public final Map> smsAsStrings() { return sms; } /** *

* Rules for Push Channel. *

*

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

* * @return Rules for Push Channel. */ public final Map> push() { return MapOfListOfOpenHoursRulesCopier.copyStringToEnum(push); } /** * For responses, this returns true if the service returned a value for the PUSH 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 hasPush() { return push != null && !(push instanceof SdkAutoConstructMap); } /** *

* Rules for Push Channel. *

*

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

* * @return Rules for Push Channel. */ public final Map> pushAsStrings() { return push; } /** *

* Rules for Voice Channel. *

*

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

* * @return Rules for Voice Channel. */ public final Map> voice() { return MapOfListOfOpenHoursRulesCopier.copyStringToEnum(voice); } /** * For responses, this returns true if the service returned a value for the VOICE 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 hasVoice() { return voice != null && !(voice instanceof SdkAutoConstructMap); } /** *

* Rules for Voice Channel. *

*

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

* * @return Rules for Voice Channel. */ public final Map> voiceAsStrings() { return voice; } /** *

* Rules for Custom Channel. *

*

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

* * @return Rules for Custom Channel. */ public final Map> custom() { return MapOfListOfOpenHoursRulesCopier.copyStringToEnum(custom); } /** * For responses, this returns true if the service returned a value for the CUSTOM 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 hasCustom() { return custom != null && !(custom instanceof SdkAutoConstructMap); } /** *

* Rules for Custom Channel. *

*

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

* * @return Rules for Custom Channel. */ public final Map> customAsStrings() { return custom; } @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(hasEmail() ? emailAsStrings() : null); hashCode = 31 * hashCode + Objects.hashCode(hasSms() ? smsAsStrings() : null); hashCode = 31 * hashCode + Objects.hashCode(hasPush() ? pushAsStrings() : null); hashCode = 31 * hashCode + Objects.hashCode(hasVoice() ? voiceAsStrings() : null); hashCode = 31 * hashCode + Objects.hashCode(hasCustom() ? customAsStrings() : null); 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 OpenHours)) { return false; } OpenHours other = (OpenHours) obj; return hasEmail() == other.hasEmail() && Objects.equals(emailAsStrings(), other.emailAsStrings()) && hasSms() == other.hasSms() && Objects.equals(smsAsStrings(), other.smsAsStrings()) && hasPush() == other.hasPush() && Objects.equals(pushAsStrings(), other.pushAsStrings()) && hasVoice() == other.hasVoice() && Objects.equals(voiceAsStrings(), other.voiceAsStrings()) && hasCustom() == other.hasCustom() && Objects.equals(customAsStrings(), other.customAsStrings()); } /** * 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("OpenHours").add("EMAIL", hasEmail() ? emailAsStrings() : null) .add("SMS", hasSms() ? smsAsStrings() : null).add("PUSH", hasPush() ? pushAsStrings() : null) .add("VOICE", hasVoice() ? voiceAsStrings() : null).add("CUSTOM", hasCustom() ? customAsStrings() : null).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "EMAIL": return Optional.ofNullable(clazz.cast(emailAsStrings())); case "SMS": return Optional.ofNullable(clazz.cast(smsAsStrings())); case "PUSH": return Optional.ofNullable(clazz.cast(pushAsStrings())); case "VOICE": return Optional.ofNullable(clazz.cast(voiceAsStrings())); case "CUSTOM": return Optional.ofNullable(clazz.cast(customAsStrings())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((OpenHours) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* Rules for Email Channel. *

* * @param email * Rules for Email Channel. * @return Returns a reference to this object so that method calls can be chained together. */ Builder emailWithStrings(Map> email); /** *

* Rules for Email Channel. *

* * @param email * Rules for Email Channel. * @return Returns a reference to this object so that method calls can be chained together. */ Builder email(Map> email); /** *

* Rules for SMS Channel. *

* * @param sms * Rules for SMS Channel. * @return Returns a reference to this object so that method calls can be chained together. */ Builder smsWithStrings(Map> sms); /** *

* Rules for SMS Channel. *

* * @param sms * Rules for SMS Channel. * @return Returns a reference to this object so that method calls can be chained together. */ Builder sms(Map> sms); /** *

* Rules for Push Channel. *

* * @param push * Rules for Push Channel. * @return Returns a reference to this object so that method calls can be chained together. */ Builder pushWithStrings(Map> push); /** *

* Rules for Push Channel. *

* * @param push * Rules for Push Channel. * @return Returns a reference to this object so that method calls can be chained together. */ Builder push(Map> push); /** *

* Rules for Voice Channel. *

* * @param voice * Rules for Voice Channel. * @return Returns a reference to this object so that method calls can be chained together. */ Builder voiceWithStrings(Map> voice); /** *

* Rules for Voice Channel. *

* * @param voice * Rules for Voice Channel. * @return Returns a reference to this object so that method calls can be chained together. */ Builder voice(Map> voice); /** *

* Rules for Custom Channel. *

* * @param custom * Rules for Custom Channel. * @return Returns a reference to this object so that method calls can be chained together. */ Builder customWithStrings(Map> custom); /** *

* Rules for Custom Channel. *

* * @param custom * Rules for Custom Channel. * @return Returns a reference to this object so that method calls can be chained together. */ Builder custom(Map> custom); } static final class BuilderImpl implements Builder { private Map> email = DefaultSdkAutoConstructMap.getInstance(); private Map> sms = DefaultSdkAutoConstructMap.getInstance(); private Map> push = DefaultSdkAutoConstructMap.getInstance(); private Map> voice = DefaultSdkAutoConstructMap.getInstance(); private Map> custom = DefaultSdkAutoConstructMap.getInstance(); private BuilderImpl() { } private BuilderImpl(OpenHours model) { emailWithStrings(model.email); smsWithStrings(model.sms); pushWithStrings(model.push); voiceWithStrings(model.voice); customWithStrings(model.custom); } public final Map> getEmail() { Map> result = MapOfListOfOpenHoursRulesCopier.copyToBuilder(this.email); if (result instanceof SdkAutoConstructMap) { return null; } return result; } public final void setEmail(Map> email) { this.email = MapOfListOfOpenHoursRulesCopier.copyFromBuilder(email); } @Override public final Builder emailWithStrings(Map> email) { this.email = MapOfListOfOpenHoursRulesCopier.copy(email); return this; } @Override public final Builder email(Map> email) { this.email = MapOfListOfOpenHoursRulesCopier.copyEnumToString(email); return this; } public final Map> getSms() { Map> result = MapOfListOfOpenHoursRulesCopier.copyToBuilder(this.sms); if (result instanceof SdkAutoConstructMap) { return null; } return result; } public final void setSms(Map> sms) { this.sms = MapOfListOfOpenHoursRulesCopier.copyFromBuilder(sms); } @Override public final Builder smsWithStrings(Map> sms) { this.sms = MapOfListOfOpenHoursRulesCopier.copy(sms); return this; } @Override public final Builder sms(Map> sms) { this.sms = MapOfListOfOpenHoursRulesCopier.copyEnumToString(sms); return this; } public final Map> getPush() { Map> result = MapOfListOfOpenHoursRulesCopier.copyToBuilder(this.push); if (result instanceof SdkAutoConstructMap) { return null; } return result; } public final void setPush(Map> push) { this.push = MapOfListOfOpenHoursRulesCopier.copyFromBuilder(push); } @Override public final Builder pushWithStrings(Map> push) { this.push = MapOfListOfOpenHoursRulesCopier.copy(push); return this; } @Override public final Builder push(Map> push) { this.push = MapOfListOfOpenHoursRulesCopier.copyEnumToString(push); return this; } public final Map> getVoice() { Map> result = MapOfListOfOpenHoursRulesCopier.copyToBuilder(this.voice); if (result instanceof SdkAutoConstructMap) { return null; } return result; } public final void setVoice(Map> voice) { this.voice = MapOfListOfOpenHoursRulesCopier.copyFromBuilder(voice); } @Override public final Builder voiceWithStrings(Map> voice) { this.voice = MapOfListOfOpenHoursRulesCopier.copy(voice); return this; } @Override public final Builder voice(Map> voice) { this.voice = MapOfListOfOpenHoursRulesCopier.copyEnumToString(voice); return this; } public final Map> getCustom() { Map> result = MapOfListOfOpenHoursRulesCopier.copyToBuilder(this.custom); if (result instanceof SdkAutoConstructMap) { return null; } return result; } public final void setCustom(Map> custom) { this.custom = MapOfListOfOpenHoursRulesCopier.copyFromBuilder(custom); } @Override public final Builder customWithStrings(Map> custom) { this.custom = MapOfListOfOpenHoursRulesCopier.copy(custom); return this; } @Override public final Builder custom(Map> custom) { this.custom = MapOfListOfOpenHoursRulesCopier.copyEnumToString(custom); return this; } @Override public OpenHours build() { return new OpenHours(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy