/* * Copyright 2018-2023 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 com.amazonaws.services.lexmodelsv2.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.protocol.StructuredPojo; import com.amazonaws.protocol.ProtocolMarshaller; /** *

* Specifies a list of message groups that Amazon Lex sends to a user to elicit a response. *

* * @see AWS * API Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class PromptSpecification implements Serializable, Cloneable, StructuredPojo { /** *

* A collection of messages that Amazon Lex can send to the user. Amazon Lex chooses the actual message to send at * runtime. *

*/ private java.util.List messageGroups; /** *

* The maximum number of times the bot tries to elicit a response from the user using this prompt. *

*/ private Integer maxRetries; /** *

* Indicates whether the user can interrupt a speech prompt from the bot. *

*/ private Boolean allowInterrupt; /** *

* Indicates how a message is selected from a message group among retries. *

*/ private String messageSelectionStrategy; /** *

* Specifies the advanced settings on each attempt of the prompt. *

*/ private java.util.Map promptAttemptsSpecification; /** *

* A collection of messages that Amazon Lex can send to the user. Amazon Lex chooses the actual message to send at * runtime. *

* * @return A collection of messages that Amazon Lex can send to the user. Amazon Lex chooses the actual message to * send at runtime. */ public java.util.List getMessageGroups() { return messageGroups; } /** *

* A collection of messages that Amazon Lex can send to the user. Amazon Lex chooses the actual message to send at * runtime. *

* * @param messageGroups * A collection of messages that Amazon Lex can send to the user. Amazon Lex chooses the actual message to * send at runtime. */ public void setMessageGroups(java.util.Collection messageGroups) { if (messageGroups == null) { this.messageGroups = null; return; } this.messageGroups = new java.util.ArrayList(messageGroups); } /** *

* A collection of messages that Amazon Lex can send to the user. Amazon Lex chooses the actual message to send at * runtime. *

*

* NOTE: This method appends the values to the existing list (if any). Use * {@link #setMessageGroups(java.util.Collection)} or {@link #withMessageGroups(java.util.Collection)} if you want * to override the existing values. *

* * @param messageGroups * A collection of messages that Amazon Lex can send to the user. Amazon Lex chooses the actual message to * send at runtime. * @return Returns a reference to this object so that method calls can be chained together. */ public PromptSpecification withMessageGroups(MessageGroup... messageGroups) { if (this.messageGroups == null) { setMessageGroups(new java.util.ArrayList(messageGroups.length)); } for (MessageGroup ele : messageGroups) { this.messageGroups.add(ele); } return this; } /** *

* A collection of messages that Amazon Lex can send to the user. Amazon Lex chooses the actual message to send at * runtime. *

* * @param messageGroups * A collection of messages that Amazon Lex can send to the user. Amazon Lex chooses the actual message to * send at runtime. * @return Returns a reference to this object so that method calls can be chained together. */ public PromptSpecification withMessageGroups(java.util.Collection messageGroups) { setMessageGroups(messageGroups); return this; } /** *

* The maximum number of times the bot tries to elicit a response from the user using this prompt. *

* * @param maxRetries * The maximum number of times the bot tries to elicit a response from the user using this prompt. */ public void setMaxRetries(Integer maxRetries) { this.maxRetries = maxRetries; } /** *

* The maximum number of times the bot tries to elicit a response from the user using this prompt. *

* * @return The maximum number of times the bot tries to elicit a response from the user using this prompt. */ public Integer getMaxRetries() { return this.maxRetries; } /** *

* The maximum number of times the bot tries to elicit a response from the user using this prompt. *

* * @param maxRetries * The maximum number of times the bot tries to elicit a response from the user using this prompt. * @return Returns a reference to this object so that method calls can be chained together. */ public PromptSpecification withMaxRetries(Integer maxRetries) { setMaxRetries(maxRetries); return this; } /** *

* Indicates whether the user can interrupt a speech prompt from the bot. *

* * @param allowInterrupt * Indicates whether the user can interrupt a speech prompt from the bot. */ public void setAllowInterrupt(Boolean allowInterrupt) { this.allowInterrupt = allowInterrupt; } /** *

* Indicates whether the user can interrupt a speech prompt from the bot. *

* * @return Indicates whether the user can interrupt a speech prompt from the bot. */ public Boolean getAllowInterrupt() { return this.allowInterrupt; } /** *

* Indicates whether the user can interrupt a speech prompt from the bot. *

* * @param allowInterrupt * Indicates whether the user can interrupt a speech prompt from the bot. * @return Returns a reference to this object so that method calls can be chained together. */ public PromptSpecification withAllowInterrupt(Boolean allowInterrupt) { setAllowInterrupt(allowInterrupt); return this; } /** *

* Indicates whether the user can interrupt a speech prompt from the bot. *

* * @return Indicates whether the user can interrupt a speech prompt from the bot. */ public Boolean isAllowInterrupt() { return this.allowInterrupt; } /** *

* Indicates how a message is selected from a message group among retries. *

* * @param messageSelectionStrategy * Indicates how a message is selected from a message group among retries. * @see MessageSelectionStrategy */ public void setMessageSelectionStrategy(String messageSelectionStrategy) { this.messageSelectionStrategy = messageSelectionStrategy; } /** *

* Indicates how a message is selected from a message group among retries. *

* * @return Indicates how a message is selected from a message group among retries. * @see MessageSelectionStrategy */ public String getMessageSelectionStrategy() { return this.messageSelectionStrategy; } /** *

* Indicates how a message is selected from a message group among retries. *

* * @param messageSelectionStrategy * Indicates how a message is selected from a message group among retries. * @return Returns a reference to this object so that method calls can be chained together. * @see MessageSelectionStrategy */ public PromptSpecification withMessageSelectionStrategy(String messageSelectionStrategy) { setMessageSelectionStrategy(messageSelectionStrategy); return this; } /** *

* Indicates how a message is selected from a message group among retries. *

* * @param messageSelectionStrategy * Indicates how a message is selected from a message group among retries. * @return Returns a reference to this object so that method calls can be chained together. * @see MessageSelectionStrategy */ public PromptSpecification withMessageSelectionStrategy(MessageSelectionStrategy messageSelectionStrategy) { this.messageSelectionStrategy = messageSelectionStrategy.toString(); return this; } /** *

* Specifies the advanced settings on each attempt of the prompt. *

* * @return Specifies the advanced settings on each attempt of the prompt. */ public java.util.Map getPromptAttemptsSpecification() { return promptAttemptsSpecification; } /** *

* Specifies the advanced settings on each attempt of the prompt. *

* * @param promptAttemptsSpecification * Specifies the advanced settings on each attempt of the prompt. */ public void setPromptAttemptsSpecification(java.util.Map promptAttemptsSpecification) { this.promptAttemptsSpecification = promptAttemptsSpecification; } /** *

* Specifies the advanced settings on each attempt of the prompt. *

* * @param promptAttemptsSpecification * Specifies the advanced settings on each attempt of the prompt. * @return Returns a reference to this object so that method calls can be chained together. */ public PromptSpecification withPromptAttemptsSpecification(java.util.Map promptAttemptsSpecification) { setPromptAttemptsSpecification(promptAttemptsSpecification); return this; } /** * Add a single PromptAttemptsSpecification entry * * @see PromptSpecification#withPromptAttemptsSpecification * @returns a reference to this object so that method calls can be chained together. */ public PromptSpecification addPromptAttemptsSpecificationEntry(String key, PromptAttemptSpecification value) { if (null == this.promptAttemptsSpecification) { this.promptAttemptsSpecification = new java.util.HashMap(); } if (this.promptAttemptsSpecification.containsKey(key)) throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided."); this.promptAttemptsSpecification.put(key, value); return this; } /** * Removes all the entries added into PromptAttemptsSpecification. * * @return Returns a reference to this object so that method calls can be chained together. */ public PromptSpecification clearPromptAttemptsSpecificationEntries() { this.promptAttemptsSpecification = null; return this; } /** * 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. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getMessageGroups() != null) sb.append("MessageGroups: ").append(getMessageGroups()).append(","); if (getMaxRetries() != null) sb.append("MaxRetries: ").append(getMaxRetries()).append(","); if (getAllowInterrupt() != null) sb.append("AllowInterrupt: ").append(getAllowInterrupt()).append(","); if (getMessageSelectionStrategy() != null) sb.append("MessageSelectionStrategy: ").append(getMessageSelectionStrategy()).append(","); if (getPromptAttemptsSpecification() != null) sb.append("PromptAttemptsSpecification: ").append(getPromptAttemptsSpecification()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof PromptSpecification == false) return false; PromptSpecification other = (PromptSpecification) obj; if (other.getMessageGroups() == null ^ this.getMessageGroups() == null) return false; if (other.getMessageGroups() != null && other.getMessageGroups().equals(this.getMessageGroups()) == false) return false; if (other.getMaxRetries() == null ^ this.getMaxRetries() == null) return false; if (other.getMaxRetries() != null && other.getMaxRetries().equals(this.getMaxRetries()) == false) return false; if (other.getAllowInterrupt() == null ^ this.getAllowInterrupt() == null) return false; if (other.getAllowInterrupt() != null && other.getAllowInterrupt().equals(this.getAllowInterrupt()) == false) return false; if (other.getMessageSelectionStrategy() == null ^ this.getMessageSelectionStrategy() == null) return false; if (other.getMessageSelectionStrategy() != null && other.getMessageSelectionStrategy().equals(this.getMessageSelectionStrategy()) == false) return false; if (other.getPromptAttemptsSpecification() == null ^ this.getPromptAttemptsSpecification() == null) return false; if (other.getPromptAttemptsSpecification() != null && other.getPromptAttemptsSpecification().equals(this.getPromptAttemptsSpecification()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getMessageGroups() == null) ? 0 : getMessageGroups().hashCode()); hashCode = prime * hashCode + ((getMaxRetries() == null) ? 0 : getMaxRetries().hashCode()); hashCode = prime * hashCode + ((getAllowInterrupt() == null) ? 0 : getAllowInterrupt().hashCode()); hashCode = prime * hashCode + ((getMessageSelectionStrategy() == null) ? 0 : getMessageSelectionStrategy().hashCode()); hashCode = prime * hashCode + ((getPromptAttemptsSpecification() == null) ? 0 : getPromptAttemptsSpecification().hashCode()); return hashCode; } @Override public PromptSpecification clone() { try { return (PromptSpecification) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } @com.amazonaws.annotation.SdkInternalApi @Override public void marshall(ProtocolMarshaller protocolMarshaller) { com.amazonaws.services.lexmodelsv2.model.transform.PromptSpecificationMarshaller.getInstance().marshall(this, protocolMarshaller); } }