* e.g., as underlying components signal ABORT without using abort(...).
*/
public class RunValidator implements IRunValidator {
- /** expect normal completion with any non-null result object */
+ /** expect normal completion with any non-null result object,
+ * except that Integer Objects must have value 0 */
public static final IRunValidator NORMAL
+ = new RunValidator(ObjectChecker.ANY_ZERO);
+ /** expect normal completion with any non-null result object */
+ public static final IRunValidator ORIGINAL_NORMAL
= new RunValidator(ObjectChecker.ANY);
/** expect normal completion and Integer result object with value 0 */
public final boolean isValid(Object input) { return true; }
public final String toString() { return "ObjectChecker.ANY"; }
};
+
/** this returns true for any non-null object */
public static final ObjectChecker NOT_NULL = new ObjectChecker() {
public boolean isValid(Object input) { return (null != input); }
- public String toString() { return "ObjectChecker.MOT_NULL"; }
+ public String toString() { return "ObjectChecker.NOT_NULL"; }
+ };
+
+ /** @return true if input is 0 Integer or any other non-Integer reference. */
+ public static final ObjectChecker ANY_ZERO = new ObjectChecker() {
+ public boolean isValid(Object input) {
+ if (input instanceof Integer) {
+ return (0 == ((Integer) input).intValue());
+ } else {
+ return true;
+ }
+ }
+ public String toString() { return "ObjectChecker.ANY_ZERO"; }
};
/**