protected ValidationException[] failedWithValue(Object value, Location location) { String description = getDescription(); String msg = String.format(description, String.valueOf(value)); return failed("Validation failed: " + msg, location); }
protected ValidationException[] result(boolean result, Object value, Location location) { return result ? passed() : failedWithValue(value, location); }
protected ValidationException[] result(boolean result, Object value) { return result(result, value, Location.UNKNOWN); }
protected T prepareRule(T rule) { if (rule instanceof RuleSupport) { RuleSupport<?> rs = (RuleSupport<?>) rule; if (description != null) rs.setDescription(description); if (sectionReference != null) rs.setSectionReference(sectionReference); rs.setSeverity(severity); } return rule; }
protected ValidationException[] failed(Exception e, Location location) { if (e instanceof ValidationException) return new ValidationException[] { (ValidationException) e }; ValidationException ve = new ValidationException(e.getMessage(), e, severity); ve.setError(getErrorCode()); ve.setLocation(location); return new ValidationException[] { ve }; }
protected ValidationException[] failed(String msg) { return failed(msg, Location.UNKNOWN); }
protected T prepareRule(T rule) { if (rule instanceof RuleSupport) { RuleSupport<?> rs = (RuleSupport<?>) rule; if (description != null) rs.setDescription(description); if (sectionReference != null) rs.setSectionReference(sectionReference); rs.setSeverity(severity); } return rule; }
protected ValidationException[] failed(Exception e, Location location) { if (e instanceof ValidationException) return new ValidationException[] { (ValidationException) e }; ValidationException ve = new ValidationException(e.getMessage(), e, severity); ve.setError(getErrorCode()); ve.setLocation(location); return new ValidationException[] { ve }; }
protected ValidationException[] failed(Exception e) { return failed(e, Location.UNKNOWN); }
protected ValidationException[] failedWithValue(Object value, Location location) { String description = getDescription(); String msg = String.format(description, String.valueOf(value)); return failed("Validation failed: " + msg, location); }
protected ValidationException[] result(boolean result, Object value, Location location) { return result ? passed() : failedWithValue(value, location); }
protected ValidationException[] failed(String msg, Location location) { ValidationException ve = new ValidationException(msg, severity); ve.setError(getErrorCode()); ve.setLocation(location); return new ValidationException[] { ve }; }
protected ValidationException[] failed(String msg) { return failed(msg, Location.UNKNOWN); }
protected ValidationException[] result(boolean result, Object value) { return result(result, value, Location.UNKNOWN); }
protected ValidationException[] failed(String msg, Location location) { ValidationException ve = new ValidationException(msg, severity); ve.setError(getErrorCode()); ve.setLocation(location); return new ValidationException[] { ve }; }
protected ValidationException[] failed(Exception e) { return failed(e, Location.UNKNOWN); }