com.amazonaws.services.amplifyuibuilder.model.FieldValidationConfiguration Maven / Gradle / Ivy
Show all versions of aws-java-sdk-amplifyuibuilder Show documentation
/*
* 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.amplifyuibuilder.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* Describes the validation configuration for a field.
*
*
* @see AWS API Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class FieldValidationConfiguration implements Serializable, Cloneable, StructuredPojo {
/**
*
* The validation to perform on an object type.
*
*/
private String type;
/**
*
* The validation to perform on a string value.
*
*/
private java.util.List strValues;
/**
*
* The validation to perform on a number value.
*
*/
private java.util.List numValues;
/**
*
* The validation message to display.
*
*/
private String validationMessage;
/**
*
* The validation to perform on an object type.
*
*
* @param type
* The validation to perform on an object type.
*/
public void setType(String type) {
this.type = type;
}
/**
*
* The validation to perform on an object type.
*
*
* @return The validation to perform on an object type.
*/
public String getType() {
return this.type;
}
/**
*
* The validation to perform on an object type.
*
*
* @param type
* The validation to perform on an object type.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public FieldValidationConfiguration withType(String type) {
setType(type);
return this;
}
/**
*
* The validation to perform on a string value.
*
*
* @return The validation to perform on a string value.
*/
public java.util.List getStrValues() {
return strValues;
}
/**
*
* The validation to perform on a string value.
*
*
* @param strValues
* The validation to perform on a string value.
*/
public void setStrValues(java.util.Collection strValues) {
if (strValues == null) {
this.strValues = null;
return;
}
this.strValues = new java.util.ArrayList(strValues);
}
/**
*
* The validation to perform on a string value.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setStrValues(java.util.Collection)} or {@link #withStrValues(java.util.Collection)} if you want to
* override the existing values.
*
*
* @param strValues
* The validation to perform on a string value.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public FieldValidationConfiguration withStrValues(String... strValues) {
if (this.strValues == null) {
setStrValues(new java.util.ArrayList(strValues.length));
}
for (String ele : strValues) {
this.strValues.add(ele);
}
return this;
}
/**
*
* The validation to perform on a string value.
*
*
* @param strValues
* The validation to perform on a string value.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public FieldValidationConfiguration withStrValues(java.util.Collection strValues) {
setStrValues(strValues);
return this;
}
/**
*
* The validation to perform on a number value.
*
*
* @return The validation to perform on a number value.
*/
public java.util.List getNumValues() {
return numValues;
}
/**
*
* The validation to perform on a number value.
*
*
* @param numValues
* The validation to perform on a number value.
*/
public void setNumValues(java.util.Collection numValues) {
if (numValues == null) {
this.numValues = null;
return;
}
this.numValues = new java.util.ArrayList(numValues);
}
/**
*
* The validation to perform on a number value.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setNumValues(java.util.Collection)} or {@link #withNumValues(java.util.Collection)} if you want to
* override the existing values.
*
*
* @param numValues
* The validation to perform on a number value.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public FieldValidationConfiguration withNumValues(Integer... numValues) {
if (this.numValues == null) {
setNumValues(new java.util.ArrayList(numValues.length));
}
for (Integer ele : numValues) {
this.numValues.add(ele);
}
return this;
}
/**
*
* The validation to perform on a number value.
*
*
* @param numValues
* The validation to perform on a number value.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public FieldValidationConfiguration withNumValues(java.util.Collection numValues) {
setNumValues(numValues);
return this;
}
/**
*
* The validation message to display.
*
*
* @param validationMessage
* The validation message to display.
*/
public void setValidationMessage(String validationMessage) {
this.validationMessage = validationMessage;
}
/**
*
* The validation message to display.
*
*
* @return The validation message to display.
*/
public String getValidationMessage() {
return this.validationMessage;
}
/**
*
* The validation message to display.
*
*
* @param validationMessage
* The validation message to display.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public FieldValidationConfiguration withValidationMessage(String validationMessage) {
setValidationMessage(validationMessage);
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 (getType() != null)
sb.append("Type: ").append(getType()).append(",");
if (getStrValues() != null)
sb.append("StrValues: ").append(getStrValues()).append(",");
if (getNumValues() != null)
sb.append("NumValues: ").append(getNumValues()).append(",");
if (getValidationMessage() != null)
sb.append("ValidationMessage: ").append(getValidationMessage());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof FieldValidationConfiguration == false)
return false;
FieldValidationConfiguration other = (FieldValidationConfiguration) obj;
if (other.getType() == null ^ this.getType() == null)
return false;
if (other.getType() != null && other.getType().equals(this.getType()) == false)
return false;
if (other.getStrValues() == null ^ this.getStrValues() == null)
return false;
if (other.getStrValues() != null && other.getStrValues().equals(this.getStrValues()) == false)
return false;
if (other.getNumValues() == null ^ this.getNumValues() == null)
return false;
if (other.getNumValues() != null && other.getNumValues().equals(this.getNumValues()) == false)
return false;
if (other.getValidationMessage() == null ^ this.getValidationMessage() == null)
return false;
if (other.getValidationMessage() != null && other.getValidationMessage().equals(this.getValidationMessage()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getType() == null) ? 0 : getType().hashCode());
hashCode = prime * hashCode + ((getStrValues() == null) ? 0 : getStrValues().hashCode());
hashCode = prime * hashCode + ((getNumValues() == null) ? 0 : getNumValues().hashCode());
hashCode = prime * hashCode + ((getValidationMessage() == null) ? 0 : getValidationMessage().hashCode());
return hashCode;
}
@Override
public FieldValidationConfiguration clone() {
try {
return (FieldValidationConfiguration) 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.amplifyuibuilder.model.transform.FieldValidationConfigurationMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}