com.amazonaws.services.pinpointsmsvoicev2.model.SelectValidation Maven / Gradle / Ivy
/*
* Copyright 2019-2024 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.pinpointsmsvoicev2.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* Validation rules for a select field.
*
*
* @see AWS API Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class SelectValidation implements Serializable, Cloneable, StructuredPojo {
/**
*
* The minimum number of choices for the select.
*
*/
private Integer minChoices;
/**
*
* The maximum number of choices for the select.
*
*/
private Integer maxChoices;
/**
*
* An array of strings for the possible selection options.
*
*/
private java.util.List options;
/**
*
* The minimum number of choices for the select.
*
*
* @param minChoices
* The minimum number of choices for the select.
*/
public void setMinChoices(Integer minChoices) {
this.minChoices = minChoices;
}
/**
*
* The minimum number of choices for the select.
*
*
* @return The minimum number of choices for the select.
*/
public Integer getMinChoices() {
return this.minChoices;
}
/**
*
* The minimum number of choices for the select.
*
*
* @param minChoices
* The minimum number of choices for the select.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public SelectValidation withMinChoices(Integer minChoices) {
setMinChoices(minChoices);
return this;
}
/**
*
* The maximum number of choices for the select.
*
*
* @param maxChoices
* The maximum number of choices for the select.
*/
public void setMaxChoices(Integer maxChoices) {
this.maxChoices = maxChoices;
}
/**
*
* The maximum number of choices for the select.
*
*
* @return The maximum number of choices for the select.
*/
public Integer getMaxChoices() {
return this.maxChoices;
}
/**
*
* The maximum number of choices for the select.
*
*
* @param maxChoices
* The maximum number of choices for the select.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public SelectValidation withMaxChoices(Integer maxChoices) {
setMaxChoices(maxChoices);
return this;
}
/**
*
* An array of strings for the possible selection options.
*
*
* @return An array of strings for the possible selection options.
*/
public java.util.List getOptions() {
return options;
}
/**
*
* An array of strings for the possible selection options.
*
*
* @param options
* An array of strings for the possible selection options.
*/
public void setOptions(java.util.Collection options) {
if (options == null) {
this.options = null;
return;
}
this.options = new java.util.ArrayList(options);
}
/**
*
* An array of strings for the possible selection options.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setOptions(java.util.Collection)} or {@link #withOptions(java.util.Collection)} if you want to override
* the existing values.
*
*
* @param options
* An array of strings for the possible selection options.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public SelectValidation withOptions(String... options) {
if (this.options == null) {
setOptions(new java.util.ArrayList(options.length));
}
for (String ele : options) {
this.options.add(ele);
}
return this;
}
/**
*
* An array of strings for the possible selection options.
*
*
* @param options
* An array of strings for the possible selection options.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public SelectValidation withOptions(java.util.Collection options) {
setOptions(options);
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 (getMinChoices() != null)
sb.append("MinChoices: ").append(getMinChoices()).append(",");
if (getMaxChoices() != null)
sb.append("MaxChoices: ").append(getMaxChoices()).append(",");
if (getOptions() != null)
sb.append("Options: ").append(getOptions());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof SelectValidation == false)
return false;
SelectValidation other = (SelectValidation) obj;
if (other.getMinChoices() == null ^ this.getMinChoices() == null)
return false;
if (other.getMinChoices() != null && other.getMinChoices().equals(this.getMinChoices()) == false)
return false;
if (other.getMaxChoices() == null ^ this.getMaxChoices() == null)
return false;
if (other.getMaxChoices() != null && other.getMaxChoices().equals(this.getMaxChoices()) == false)
return false;
if (other.getOptions() == null ^ this.getOptions() == null)
return false;
if (other.getOptions() != null && other.getOptions().equals(this.getOptions()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getMinChoices() == null) ? 0 : getMinChoices().hashCode());
hashCode = prime * hashCode + ((getMaxChoices() == null) ? 0 : getMaxChoices().hashCode());
hashCode = prime * hashCode + ((getOptions() == null) ? 0 : getOptions().hashCode());
return hashCode;
}
@Override
public SelectValidation clone() {
try {
return (SelectValidation) 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.pinpointsmsvoicev2.model.transform.SelectValidationMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}