public StageDeclaration withOnFailure(FailureConditions onFailure) {
        setOnFailure(onFailure);
        return this;
    }
<p>
The method to use when a stage has not completed successfully. For example, configuring this field for rollback
will roll back a failed stage automatically to the last successful pipeline execution in the stage.
</p>

@param onFailure
       The method to use when a stage has not completed successfully. For example, configuring this field for
       rollback will roll back a failed stage automatically to the last successful pipeline execution in the
       stage.
@return Returns a reference to this object so that method calls can be chained together.
aws-java-sdk-codepipeline/src/main/java/com/amazonaws/services/codepipeline/model/StageDeclaration.java