@Override public void validate(Object value) throws InvalidValueException { // isValidType ensures that value can safely be cast to TYPE if (!isValidType(value) || !isValidValue((T) value)) { String message = getErrorMessage().replace("{0}", String.valueOf(value)); throw new InvalidValueException(message); } }
getModelType(), getLocale()); } catch (ConversionException e) { throw new InvalidValueException( getConversionError(getConverter().getModelType(), e)); throw new Validator.InvalidValueException(null, exceptionArray);
@Override public void validate(final Object value) throws InvalidValueException { Set<?> violations = getJavaxBeanValidator().validateValue(beanClass, propertyName, value); if (!violations.isEmpty()) { InvalidValueException[] causes = new InvalidValueException[violations .size()]; int i = 0; for (Object v : violations) { final ConstraintViolation<?> violation = (ConstraintViolation<?>) v; String msg = getJavaxBeanValidatorFactory() .getMessageInterpolator() .interpolate(violation.getMessageTemplate(), new SimpleContext(value, violation.getConstraintDescriptor()), locale); causes[i] = new InvalidValueException(msg); ++i; } throw new InvalidValueException(null, causes); } }
int intValue = Integer.parseInt((String) value); if (intValue <= 0) { throw new Validator.InvalidValueException("Weight must be > 0"); throw new Validator.InvalidValueException("Weight must be a number");
throw new Validator.InvalidValueException("Threshold must be a positive number"); throw new Validator.InvalidValueException("Base must be greater than 1.0");
if (value != null) { if (((Integer) value).intValue() <= 0) { throw new Validator.InvalidValueException("must be > 0"); if (value != null) { if (((Long) value).intValue() <= 0) { throw new Validator.InvalidValueException("must be > 0");
throw new Validator.InvalidValueException(em); } else { throw first;
/** * Validates the data given in value. * * @param value * the value to validate. * @throws Validator.InvalidValueException * if the value was invalid. */ @Override public void validate(Object value) throws Validator.InvalidValueException { if ((onlyNullAllowed && value != null) || (!onlyNullAllowed && value == null)) { throw new Validator.InvalidValueException(errorMessage); } }