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

software.amazon.awssdk.services.pinpoint.model.ClosedDays 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.27.19
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.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
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.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

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

*/ @Generated("software.amazon.awssdk:codegen") public final class ClosedDays implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField> EMAIL_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("EMAIL") .getter(getter(ClosedDays::email)) .setter(setter(Builder::email)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EMAIL").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(ClosedDaysRule::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField> SMS_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("SMS") .getter(getter(ClosedDays::sms)) .setter(setter(Builder::sms)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SMS").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(ClosedDaysRule::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField> PUSH_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("PUSH") .getter(getter(ClosedDays::push)) .setter(setter(Builder::push)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PUSH").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(ClosedDaysRule::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField> VOICE_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("VOICE") .getter(getter(ClosedDays::voice)) .setter(setter(Builder::voice)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VOICE").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(ClosedDaysRule::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField> CUSTOM_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("CUSTOM") .getter(getter(ClosedDays::custom)) .setter(setter(Builder::custom)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CUSTOM").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(ClosedDaysRule::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").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 List email; private final List sms; private final List push; private final List voice; private final List custom; private ClosedDays(BuilderImpl builder) { this.email = builder.email; this.sms = builder.sms; this.push = builder.push; this.voice = builder.voice; this.custom = builder.custom; } /** * 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 SdkAutoConstructList); } /** *

* Rules for the 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 the Email channel. */ public final List email() { return email; } /** * 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 SdkAutoConstructList); } /** *

* Rules for the 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 the SMS channel. */ public final List sms() { return sms; } /** * 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 SdkAutoConstructList); } /** *

* Rules for the 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 the Push channel. */ public final List push() { return push; } /** * 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 SdkAutoConstructList); } /** *

* Rules for the 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 the Voice channel. */ public final List voice() { return voice; } /** * 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 SdkAutoConstructList); } /** *

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

* Rules for the Email channel. *

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

* Rules for the Email channel. *

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

* Rules for the Email channel. *

* This is a convenience method that creates an instance of the * {@link software.amazon.awssdk.services.pinpoint.model.ClosedDaysRule.Builder} avoiding the need to create one * manually via {@link software.amazon.awssdk.services.pinpoint.model.ClosedDaysRule#builder()}. * *

* When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.pinpoint.model.ClosedDaysRule.Builder#build()} is called immediately * and its result is passed to {@link #email(List)}. * * @param email * a consumer that will call methods on * {@link software.amazon.awssdk.services.pinpoint.model.ClosedDaysRule.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #email(java.util.Collection) */ Builder email(Consumer... email); /** *

* Rules for the SMS channel. *

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

* Rules for the SMS channel. *

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

* Rules for the SMS channel. *

* This is a convenience method that creates an instance of the * {@link software.amazon.awssdk.services.pinpoint.model.ClosedDaysRule.Builder} avoiding the need to create one * manually via {@link software.amazon.awssdk.services.pinpoint.model.ClosedDaysRule#builder()}. * *

* When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.pinpoint.model.ClosedDaysRule.Builder#build()} is called immediately * and its result is passed to {@link #sms(List)}. * * @param sms * a consumer that will call methods on * {@link software.amazon.awssdk.services.pinpoint.model.ClosedDaysRule.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #sms(java.util.Collection) */ Builder sms(Consumer... sms); /** *

* Rules for the Push channel. *

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

* Rules for the Push channel. *

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

* Rules for the Push channel. *

* This is a convenience method that creates an instance of the * {@link software.amazon.awssdk.services.pinpoint.model.ClosedDaysRule.Builder} avoiding the need to create one * manually via {@link software.amazon.awssdk.services.pinpoint.model.ClosedDaysRule#builder()}. * *

* When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.pinpoint.model.ClosedDaysRule.Builder#build()} is called immediately * and its result is passed to {@link #push(List)}. * * @param push * a consumer that will call methods on * {@link software.amazon.awssdk.services.pinpoint.model.ClosedDaysRule.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #push(java.util.Collection) */ Builder push(Consumer... push); /** *

* Rules for the Voice channel. *

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

* Rules for the Voice channel. *

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

* Rules for the Voice channel. *

* This is a convenience method that creates an instance of the * {@link software.amazon.awssdk.services.pinpoint.model.ClosedDaysRule.Builder} avoiding the need to create one * manually via {@link software.amazon.awssdk.services.pinpoint.model.ClosedDaysRule#builder()}. * *

* When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.pinpoint.model.ClosedDaysRule.Builder#build()} is called immediately * and its result is passed to {@link #voice(List)}. * * @param voice * a consumer that will call methods on * {@link software.amazon.awssdk.services.pinpoint.model.ClosedDaysRule.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #voice(java.util.Collection) */ Builder voice(Consumer... voice); /** *

* Rules for the Custom channel. *

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

* Rules for the Custom channel. *

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

* Rules for the Custom channel. *

* This is a convenience method that creates an instance of the * {@link software.amazon.awssdk.services.pinpoint.model.ClosedDaysRule.Builder} avoiding the need to create one * manually via {@link software.amazon.awssdk.services.pinpoint.model.ClosedDaysRule#builder()}. * *

* When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.pinpoint.model.ClosedDaysRule.Builder#build()} is called immediately * and its result is passed to {@link #custom(List)}. * * @param custom * a consumer that will call methods on * {@link software.amazon.awssdk.services.pinpoint.model.ClosedDaysRule.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #custom(java.util.Collection) */ Builder custom(Consumer... custom); } static final class BuilderImpl implements Builder { private List email = DefaultSdkAutoConstructList.getInstance(); private List sms = DefaultSdkAutoConstructList.getInstance(); private List push = DefaultSdkAutoConstructList.getInstance(); private List voice = DefaultSdkAutoConstructList.getInstance(); private List custom = DefaultSdkAutoConstructList.getInstance(); private BuilderImpl() { } private BuilderImpl(ClosedDays model) { email(model.email); sms(model.sms); push(model.push); voice(model.voice); custom(model.custom); } public final List getEmail() { List result = ListOfClosedDaysRulesCopier.copyToBuilder(this.email); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setEmail(Collection email) { this.email = ListOfClosedDaysRulesCopier.copyFromBuilder(email); } @Override public final Builder email(Collection email) { this.email = ListOfClosedDaysRulesCopier.copy(email); return this; } @Override @SafeVarargs public final Builder email(ClosedDaysRule... email) { email(Arrays.asList(email)); return this; } @Override @SafeVarargs public final Builder email(Consumer... email) { email(Stream.of(email).map(c -> ClosedDaysRule.builder().applyMutation(c).build()).collect(Collectors.toList())); return this; } public final List getSms() { List result = ListOfClosedDaysRulesCopier.copyToBuilder(this.sms); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setSms(Collection sms) { this.sms = ListOfClosedDaysRulesCopier.copyFromBuilder(sms); } @Override public final Builder sms(Collection sms) { this.sms = ListOfClosedDaysRulesCopier.copy(sms); return this; } @Override @SafeVarargs public final Builder sms(ClosedDaysRule... sms) { sms(Arrays.asList(sms)); return this; } @Override @SafeVarargs public final Builder sms(Consumer... sms) { sms(Stream.of(sms).map(c -> ClosedDaysRule.builder().applyMutation(c).build()).collect(Collectors.toList())); return this; } public final List getPush() { List result = ListOfClosedDaysRulesCopier.copyToBuilder(this.push); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setPush(Collection push) { this.push = ListOfClosedDaysRulesCopier.copyFromBuilder(push); } @Override public final Builder push(Collection push) { this.push = ListOfClosedDaysRulesCopier.copy(push); return this; } @Override @SafeVarargs public final Builder push(ClosedDaysRule... push) { push(Arrays.asList(push)); return this; } @Override @SafeVarargs public final Builder push(Consumer... push) { push(Stream.of(push).map(c -> ClosedDaysRule.builder().applyMutation(c).build()).collect(Collectors.toList())); return this; } public final List getVoice() { List result = ListOfClosedDaysRulesCopier.copyToBuilder(this.voice); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setVoice(Collection voice) { this.voice = ListOfClosedDaysRulesCopier.copyFromBuilder(voice); } @Override public final Builder voice(Collection voice) { this.voice = ListOfClosedDaysRulesCopier.copy(voice); return this; } @Override @SafeVarargs public final Builder voice(ClosedDaysRule... voice) { voice(Arrays.asList(voice)); return this; } @Override @SafeVarargs public final Builder voice(Consumer... voice) { voice(Stream.of(voice).map(c -> ClosedDaysRule.builder().applyMutation(c).build()).collect(Collectors.toList())); return this; } public final List getCustom() { List result = ListOfClosedDaysRulesCopier.copyToBuilder(this.custom); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setCustom(Collection custom) { this.custom = ListOfClosedDaysRulesCopier.copyFromBuilder(custom); } @Override public final Builder custom(Collection custom) { this.custom = ListOfClosedDaysRulesCopier.copy(custom); return this; } @Override @SafeVarargs public final Builder custom(ClosedDaysRule... custom) { custom(Arrays.asList(custom)); return this; } @Override @SafeVarargs public final Builder custom(Consumer... custom) { custom(Stream.of(custom).map(c -> ClosedDaysRule.builder().applyMutation(c).build()).collect(Collectors.toList())); return this; } @Override public ClosedDays build() { return new ClosedDays(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy