Tidy up a TODO

This commit is contained in:
dsyer
2010-01-14 14:23:23 +00:00
parent 8f8f455c8d
commit d60c726121
2 changed files with 18 additions and 7 deletions

View File

@@ -350,9 +350,7 @@ public abstract class AbstractFlowParser extends AbstractSingleBeanDefinitionPar
BeanDefinition endState = null;
// TODO: revise this for clarity
if (status == FlowExecutionStatus.STOPPED || status == FlowExecutionStatus.COMPLETED
|| status == FlowExecutionStatus.FAILED) {
if (status.isEnd()) {
BeanDefinitionBuilder endBuilder = BeanDefinitionBuilder
.genericBeanDefinition("org.springframework.batch.core.job.flow.support.state.EndState");

View File

@@ -15,7 +15,6 @@
*/
package org.springframework.batch.core.job.flow;
/**
* This class is used as a holder for a BatchStatus/ExitStatus pair.
*
@@ -70,7 +69,7 @@ public class FlowExecutionStatus implements Comparable<FlowExecutionStatus> {
public FlowExecutionStatus(String status) {
this.name = status;
}
/**
* @return true if the status starts with "STOPPED"
*/
@@ -84,7 +83,21 @@ public class FlowExecutionStatus implements Comparable<FlowExecutionStatus> {
public boolean isFail() {
return name.startsWith(FAILED.getName());
}
/**
* @return true if this status represents the end of a flow
*/
public boolean isEnd() {
return isStop() || isFail() || isComplete();
}
/**
* @return true if the status starts with "COMPLETED"
*/
private boolean isComplete() {
return name.startsWith(COMPLETED.getName());
}
/**
* Create an ordering on {@link FlowExecutionStatus} instances by comparing
* their statuses.
@@ -120,7 +133,7 @@ public class FlowExecutionStatus implements Comparable<FlowExecutionStatus> {
FlowExecutionStatus other = (FlowExecutionStatus) object;
return name.equals(other.name);
}
@Override
public int hashCode() {
return name.hashCode();