/* * 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; /** *
* Provides a list of conditional branches. Branches are evaluated in the order that they are entered in the list. The * first branch with a condition that evaluates to true is executed. The last branch in the list is the default branch. * The default branch should not have any condition expression. The default branch is executed if no other branch has a * matching condition. *
* * @see AWS API Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class ConditionalSpecification implements Serializable, Cloneable, StructuredPojo { /** *
* Determines whether a conditional branch is active. When active
is false, the conditions are not
* evaluated.
*
* A list of conditional branches. A conditional branch is made up of a condition, a response and a next step. The * response and next step are executed when the condition is true. *
*/ private java.util.List* The conditional branch that should be followed when the conditions for other branches are not satisfied. A * conditional branch is made up of a condition, a response and a next step. *
*/ private DefaultConditionalBranch defaultBranch; /** *
* Determines whether a conditional branch is active. When active
is false, the conditions are not
* evaluated.
*
active
is false, the conditions are
* not evaluated.
*/
public void setActive(Boolean active) {
this.active = active;
}
/**
*
* Determines whether a conditional branch is active. When active
is false, the conditions are not
* evaluated.
*
active
is false, the conditions are
* not evaluated.
*/
public Boolean getActive() {
return this.active;
}
/**
*
* Determines whether a conditional branch is active. When active
is false, the conditions are not
* evaluated.
*
active
is false, the conditions are
* not evaluated.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ConditionalSpecification withActive(Boolean active) {
setActive(active);
return this;
}
/**
*
* Determines whether a conditional branch is active. When active
is false, the conditions are not
* evaluated.
*
active
is false, the conditions are
* not evaluated.
*/
public Boolean isActive() {
return this.active;
}
/**
* * A list of conditional branches. A conditional branch is made up of a condition, a response and a next step. The * response and next step are executed when the condition is true. *
* * @return A list of conditional branches. A conditional branch is made up of a condition, a response and a next * step. The response and next step are executed when the condition is true. */ public java.util.List* A list of conditional branches. A conditional branch is made up of a condition, a response and a next step. The * response and next step are executed when the condition is true. *
* * @param conditionalBranches * A list of conditional branches. A conditional branch is made up of a condition, a response and a next * step. The response and next step are executed when the condition is true. */ public void setConditionalBranches(java.util.Collection* A list of conditional branches. A conditional branch is made up of a condition, a response and a next step. The * response and next step are executed when the condition is true. *
** NOTE: This method appends the values to the existing list (if any). Use * {@link #setConditionalBranches(java.util.Collection)} or {@link #withConditionalBranches(java.util.Collection)} * if you want to override the existing values. *
* * @param conditionalBranches * A list of conditional branches. A conditional branch is made up of a condition, a response and a next * step. The response and next step are executed when the condition is true. * @return Returns a reference to this object so that method calls can be chained together. */ public ConditionalSpecification withConditionalBranches(ConditionalBranch... conditionalBranches) { if (this.conditionalBranches == null) { setConditionalBranches(new java.util.ArrayList* A list of conditional branches. A conditional branch is made up of a condition, a response and a next step. The * response and next step are executed when the condition is true. *
* * @param conditionalBranches * A list of conditional branches. A conditional branch is made up of a condition, a response and a next * step. The response and next step are executed when the condition is true. * @return Returns a reference to this object so that method calls can be chained together. */ public ConditionalSpecification withConditionalBranches(java.util.Collection* The conditional branch that should be followed when the conditions for other branches are not satisfied. A * conditional branch is made up of a condition, a response and a next step. *
* * @param defaultBranch * The conditional branch that should be followed when the conditions for other branches are not satisfied. A * conditional branch is made up of a condition, a response and a next step. */ public void setDefaultBranch(DefaultConditionalBranch defaultBranch) { this.defaultBranch = defaultBranch; } /** ** The conditional branch that should be followed when the conditions for other branches are not satisfied. A * conditional branch is made up of a condition, a response and a next step. *
* * @return The conditional branch that should be followed when the conditions for other branches are not satisfied. * A conditional branch is made up of a condition, a response and a next step. */ public DefaultConditionalBranch getDefaultBranch() { return this.defaultBranch; } /** ** The conditional branch that should be followed when the conditions for other branches are not satisfied. A * conditional branch is made up of a condition, a response and a next step. *
* * @param defaultBranch * The conditional branch that should be followed when the conditions for other branches are not satisfied. A * conditional branch is made up of a condition, a response and a next step. * @return Returns a reference to this object so that method calls can be chained together. */ public ConditionalSpecification withDefaultBranch(DefaultConditionalBranch defaultBranch) { setDefaultBranch(defaultBranch); 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 (getActive() != null) sb.append("Active: ").append(getActive()).append(","); if (getConditionalBranches() != null) sb.append("ConditionalBranches: ").append(getConditionalBranches()).append(","); if (getDefaultBranch() != null) sb.append("DefaultBranch: ").append(getDefaultBranch()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof ConditionalSpecification == false) return false; ConditionalSpecification other = (ConditionalSpecification) obj; if (other.getActive() == null ^ this.getActive() == null) return false; if (other.getActive() != null && other.getActive().equals(this.getActive()) == false) return false; if (other.getConditionalBranches() == null ^ this.getConditionalBranches() == null) return false; if (other.getConditionalBranches() != null && other.getConditionalBranches().equals(this.getConditionalBranches()) == false) return false; if (other.getDefaultBranch() == null ^ this.getDefaultBranch() == null) return false; if (other.getDefaultBranch() != null && other.getDefaultBranch().equals(this.getDefaultBranch()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getActive() == null) ? 0 : getActive().hashCode()); hashCode = prime * hashCode + ((getConditionalBranches() == null) ? 0 : getConditionalBranches().hashCode()); hashCode = prime * hashCode + ((getDefaultBranch() == null) ? 0 : getDefaultBranch().hashCode()); return hashCode; } @Override public ConditionalSpecification clone() { try { return (ConditionalSpecification) 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.ConditionalSpecificationMarshaller.getInstance().marshall(this, protocolMarshaller); } }