/** * Validates the given Object. * * @param object the Object to validate * @throws ValidationException if the object fails validation. */ public void validate(final Object object) throws ValidationException { validate(object, (ValidationContext) null); } // -- validate
BigDecimal clean = stripTrailingZeros(bd); String temp = toStringForBigDecimal(clean); int length = temp.length(); if (temp.indexOf('-') == 0) { if (hasPattern()) { super.validate(toStringForBigDecimal(bd), context);
BigDecimal clean = stripTrailingZeros(bd); String temp = toStringForBigDecimal(clean); int length = temp.length(); if (temp.indexOf('-') == 0) { if (hasPattern()) { super.validate(toStringForBigDecimal(bd), context);
/** * Validates the given Object. * * @param object * the Object to validate * @throws ValidationException if the object fails validation. */ public void validate(final Object object) throws ValidationException { validate(object, (ValidationContext) null); } // -- validate
/** * Validates the given Object. * * @param object the Object to validate * @param context the ValidationContext * @throws ValidationException if the object fails validation. */ public void validate(final Object object, final ValidationContext context) throws ValidationException { if (object == null) { String err = "decimalValidator cannot validate a null object."; throw new ValidationException(err); } BigDecimal value = null; if (object instanceof BigDecimal) { value = (BigDecimal) object; } else { try { value = new java.math.BigDecimal(object.toString()); } catch (Exception ex) { String err = "Expecting a decimal, received instead: " + object.getClass().getName(); throw new ValidationException(err); } } validate(value, context); } // -- validate
/** * Validates the given Object. * * @param object * the Object to validate * @param context * the ValidationContext * @throws ValidationException if the object fails validation. */ public void validate(final Object object, final ValidationContext context) throws ValidationException { if (object == null) { String err = "decimalValidator cannot validate a null object."; throw new ValidationException(err); } BigDecimal value = null; if (object instanceof BigDecimal) { value = (BigDecimal) object; } else { try { value = new java.math.BigDecimal(object.toString()); } catch (Exception ex) { String err = "Expecting a decimal, received instead: " + object.getClass().getName(); throw new ValidationException(err); } } validate(value, context); } //-- validate